[riot-notifications] [RIOT-OS/RIOT] tsrb: change input type to `uint8_t` (#11634)

Kaspar Schleiser notifications at github.com
Wed Jun 5 14:19:42 CEST 2019

kaspar030 commented on this pull request.

>  {
     rb->buf[rb->writes++ & (rb->size - 1)] = c;
-static char _pop(tsrb_t *rb)
+static uint8_t _pop(tsrb_t *rb)
     return rb->buf[rb->reads++ & (rb->size - 1)];
 int tsrb_get_one(tsrb_t *rb)

I don't think this is a good idea. _pop()ing too far completely messes up the ringbuffer. I'd rather not expose that towards the users.

All sane usages would look like your example. So IMO it is more sane to keep that as:

int c = tsrb_get_one(rb);
if (c < 0) {
     DEBUG("ring buffer empty!\n");
    /* do error handling if required */

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190605/52575850/attachment.html>

More information about the notifications mailing list