
14 Aug
2023
14 Aug
'23
5:03 a.m.
Dear Simon and other developers,
- cursor = cbmem_console_p->buffer_cursor++;
- if (cursor < cbmem_console_p->buffer_size)
cbmem_console_p->buffer_body[cursor] = data;
- pos = cons->cursor++;
- if (pos < cons->size)
cons->body[pos] = data;
While at it, is it OK to increment cons->cursor unconditionally, even when the buffer is full?
It's better to do it after the check, isn't it? E.g.:
if (cons->cursor < cons->size) cons->body[cons->cursor++] = data;
Cheers, Alex.