rstream: Initialize 'rstream' field in RBuffer class

This field is used in a conditional jump, so this initialization is fixing a
bug.
rstream: Add rbuffer_read_ptr/rbuffer_write_ptr functions

rbuffer_data was renamed to rbuffer_read_ptr, and it represents the next read
position in a RBuffer instance. Similarly, rbuffer_write_ptr was added to
represent the next write position.

Also, rbuffer_data was being used for writing(in alloc_cb), replace that by
rbuffer_write_ptr.
Merge PR #1306 'RBuffer fixes'