The ring buffer does not support 0 as data value, but expects this as an end marker. Thus I wonder if rb_new()should do a r->base[0] = 0 to ensure it starts with an empty buffer. Or do a check that the buffer contains at least one NULL value of pre-filled buffers are also supported. Otherwise rb_poll_byte() would loop forever in the worst case.
Follow-up from https://github.com/seL4/projects_libs/pull/18#discussion_r1003527717
The ring buffer does not support 0 as data value, but expects this as an end marker. Thus I wonder if
rb_new()
should do ar->base[0] = 0
to ensure it starts with an empty buffer. Or do a check that the buffer contains at least one NULL value of pre-filled buffers are also supported. Otherwiserb_poll_byte()
would loop forever in the worst case.