Is this what you mean? 

```c
  for (rv = 0; in_buffer.rpos < in_buffer.wpos && rv < count; rv++, in_buffer.rpos++)
    buf[rv] = in_buffer.data[in_buffer.rpos];
```