aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-06-17 10:02:23 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-06-18 11:36:07 -0300
commitabc423983d85d5110fae21e661d36075379ce9c3 (patch)
tree9c7441c081522d47f77c4e68504bebdca0f0148c /src/nvim/os
parent287967a2c0bba99a95131d36b94c8a880aa3b62b (diff)
downloadrneovim-abc423983d85d5110fae21e661d36075379ce9c3.tar.gz
rneovim-abc423983d85d5110fae21e661d36075379ce9c3.tar.bz2
rneovim-abc423983d85d5110fae21e661d36075379ce9c3.zip
job: Refactor job_write to receive WBuffer instances.
This was done to give more control over memory management to job_write callers.
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/job.c7
-rw-r--r--src/nvim/os/job.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/os/job.c b/src/nvim/os/job.c
index d51b67da53..0119e347dd 100644
--- a/src/nvim/os/job.c
+++ b/src/nvim/os/job.c
@@ -260,13 +260,12 @@ void job_stop(Job *job)
/// returns when the write request was sent.
///
/// @param job The Job instance
-/// @param data Buffer containing the data to be written
-/// @param len Size of the data
+/// @param buffer The buffer which contains the data to be written
/// @return true if the write request was successfully sent, false if writing
/// to the job stream failed (possibly because the OS buffer is full)
-bool job_write(Job *job, char *data, uint32_t len)
+bool job_write(Job *job, WBuffer *buffer)
{
- return wstream_write(job->in, wstream_new_buffer(data, len, free));
+ return wstream_write(job->in, buffer);
}
/// Sets the `defer` flag for a Job instance
diff --git a/src/nvim/os/job.h b/src/nvim/os/job.h
index f48218ffe7..e0ca615626 100644
--- a/src/nvim/os/job.h
+++ b/src/nvim/os/job.h
@@ -12,6 +12,8 @@
#include "nvim/os/rstream_defs.h"
#include "nvim/os/event_defs.h"
+#include "nvim/os/wstream.h"
+#include "nvim/os/wstream_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/job.h.generated.h"