One more important note: the current implementation has a potential buffer overrun issue, because it writes first, and only then checks whether that may have overrun the buffer. And the check itself is off by one, too:

   wpbuf[wpixput++] = x; \
   if (wpixput > WPBUF_LEN) \
    wpixput--; \

That's why my latest code snippet does it differently:

>      if (ixput < WPBUF_LEN)
>        {
>          buf[ixput++] = x;
>        }

Reply via email to