mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user