From 0c764fb1a48ad7ad51766ee480e0cd0d3a43566b Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Tue, 17 Jun 2014 10:01:33 -0300 Subject: wstream: Change wstream_write failure behavior Before this change, any write that could cause a WStream instance to use more than `maxmem` would fail, which is not acceptable when writing big chunks of data. (This could happen when returning contents from a big buffer through the API, for example). Writes of any size are now allowed, but before we check if the currently used memory doesn't break the limit. This should be enough to prevent us from stacking data when talking to a locked process. --- src/nvim/os/wstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/os/wstream.c b/src/nvim/os/wstream.c index c2ed05b78f..6a4cecf218 100644 --- a/src/nvim/os/wstream.c +++ b/src/nvim/os/wstream.c @@ -90,7 +90,7 @@ bool wstream_write(WStream *wstream, WBuffer *buffer) // This should not be called after a wstream was freed assert(!wstream->freed); - if (wstream->curmem + buffer->size > wstream->maxmem) { + if (wstream->curmem > wstream->maxmem) { return false; } -- cgit