rstream: Extract some RStream functionality to RBuffer

RBuffer instances represent the internal buffer used by RStreams.

This changes RStream constructor to receive RBuffer pointers and adds a set of
RBuffer methods that expose the lower level buffer manipulation to consumers of
the RStream API.
This commit is contained in:
Thiago de Arruda
2014-10-17 09:17:12 -03:00
parent 56ef9e8668
commit 68de5d79a2
7 changed files with 185 additions and 84 deletions

View File

@@ -341,7 +341,7 @@ static void system_data_cb(RStream *rstream, void *data, bool eof)
Job *job = data;
dyn_buffer_t *buf = job_data(job);
size_t nread = rstream_available(rstream);
size_t nread = rstream_pending(rstream);
dyn_buf_ensure(buf, buf->len + nread + 1);
rstream_read(rstream, buf->data + buf->len, nread);