aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-06-17 10:01:33 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-06-17 12:12:29 -0300
commit0c764fb1a48ad7ad51766ee480e0cd0d3a43566b (patch)
tree3ff7784177d0d3db00f3b1a775f4ceee239689b1 /src
parent063d8a5773b8c0a1a3cac97c7b72c91d560264cf (diff)
downloadrneovim-0c764fb1a48ad7ad51766ee480e0cd0d3a43566b.tar.gz
rneovim-0c764fb1a48ad7ad51766ee480e0cd0d3a43566b.tar.bz2
rneovim-0c764fb1a48ad7ad51766ee480e0cd0d3a43566b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/wstream.c2
1 files changed, 1 insertions, 1 deletions
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;
}