diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-17 09:17:12 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-18 08:42:49 -0300 |
commit | 68de5d79a243fecc9ef256d9d0356f8541aa3821 (patch) | |
tree | 41250bef42d81344a36d6056f211d761be6e876d /src/nvim/os/channel.c | |
parent | 56ef9e86688e79dc6a6bffe73c505eaaddf3be2d (diff) | |
download | rneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.tar.gz rneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.tar.bz2 rneovim-68de5d79a243fecc9ef256d9d0356f8541aa3821.zip |
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.
Diffstat (limited to 'src/nvim/os/channel.c')
-rw-r--r-- | src/nvim/os/channel.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/os/channel.c b/src/nvim/os/channel.c index 5598b485ba..959fbc6e73 100644 --- a/src/nvim/os/channel.c +++ b/src/nvim/os/channel.c @@ -127,7 +127,7 @@ void channel_from_stream(uv_stream_t *stream) channel->is_job = false; // read stream channel->data.streams.read = rstream_new(parse_msgpack, - CHANNEL_BUFFER_SIZE, + rbuffer_new(CHANNEL_BUFFER_SIZE), channel, NULL); rstream_set_stream(channel->data.streams.read, stream); @@ -290,7 +290,7 @@ static void channel_from_stdio(void) channel->is_job = false; // read stream channel->data.streams.read = rstream_new(parse_msgpack, - CHANNEL_BUFFER_SIZE, + rbuffer_new(CHANNEL_BUFFER_SIZE), channel, NULL); rstream_set_file(channel->data.streams.read, 0); @@ -313,7 +313,7 @@ static void job_err(RStream *rstream, void *data, bool eof) char buf[256]; Channel *channel = job_data(data); - while ((count = rstream_available(rstream))) { + while ((count = rstream_pending(rstream))) { size_t read = rstream_read(rstream, buf, sizeof(buf) - 1); buf[read] = NUL; ELOG("Channel %" PRIu64 " stderr: %s", channel->id, buf); @@ -336,7 +336,7 @@ static void parse_msgpack(RStream *rstream, void *data, bool eof) goto end; } - uint32_t count = rstream_available(rstream); + uint32_t count = rstream_pending(rstream); DLOG("Feeding the msgpack parser with %u bytes of data from RStream(%p)", count, rstream); |