aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/wstream.c
Commit message (Collapse)AuthorAge
* rstream/wstream: Unify structures and simplify APIThiago de Arruda2015-07-17
| | | | | | | | | | | | | - Simplify RStream/WStream API and make it more consistent with libuv. - Move into the event loop layer(event subdirectory) - Remove uv_helpers module. - Simplify job/process internal modules/API. - Unify RStream and WStream into a single structure. This is necessary because libuv streams can be readable and writable at the same time(and because the uv_helpers.c hack to associate multiple streams with libuv handle was removed) - Make struct definition public, allowing more flexible/simple memory management by users of the module. - Adapt channel/job modules to cope with the changes.
* event loop: New abstraction layer with refactored time/signal APIThiago de Arruda2015-07-17
| | | | | | | | | | - Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts.
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* memory: Replace klib memory pools by malloc/freeThiago de Arruda2015-04-12
| | | | | | Klib pools were used to improve allocation efficiency for some small objects, but it is not a thread-safe approach. Thread safety in allocations will be required for implementing #2371).
* Fix a memory leak for WBuffers used in channel_write().oni-link2015-04-03
| | | | | | | channel_write() uses a ref-counted buffer for writing. This buffer should be released if it was used in "refcount" channel_write() calls. But calling channel_write() on a closed channel would return early and not decrease the refcount of the used buffer.
* Fix unused variable in wstream.c for a release build.John Szakmeister2015-03-14
|
* Try to fix problem found in the Travis Ci build.oni-link2014-11-09
| | | | | | | An uv_pipe_t handle for a WStream could be left open for a particular code path. Patch by tarruda.
* wstream: Memory allocation improvementsThiago de Arruda2014-11-02
| | | | | | - Rename WriteData to WRequest - Inline uv_write_t into WRequest, avoiding an extra allocation - Manage WBuffer/WRequest instances using klib memory pools
* wstream/shell: Fix memory errors caused by os_systemThiago de Arruda2014-10-01
| | | | | | | | | | | | | | The os_system function uses a write callback to close the input stream when the write completes, but this causes a memory error because the callback is invoked right before the stream is freed by the caller. This fixes the problem by removing the callback set by os_system. Instead, it calls job_close_in immediately after writing(the stream will only close after the write completes). The 'pending' parameter was also removed from the 'write_cb' as it should be hidden by the wstream module. While the `wstream_set_write_cb` and `job_write_cb` are no longer used, they will remain in the codebase for future use.
* wstream: Fix close/freeThiago de Arruda2014-09-12
| | | | The current code was leading to an invalid free when the wstream was closed
* wstream: Implement wstream_set_fileThiago de Arruda2014-08-28
| | | | | | It's analogous to rstream_set_file but only supports pipes(Support for regular files may be added later). This function was added to support creating API channels via stdout.
* wstream: allow empty release wbuffer cbNicolas Hillegeer2014-07-27
| | | | | Sometimes a wbuffer is not supposed to be free()'d (such as when it comes from a constant (possibly static) string, for example.
* wstream: write completion callbackNicolas Hillegeer2014-07-27
| | | | Now modules using the wstream can find out what's happening to their writes.
* wstream: Pass WBuffer refcount as a constructor parameterThiago de Arruda2014-07-17
| | | | | | This is required to handle broadcasting when the first write fails. Ref: https://github.com/tarruda/neovim/commit/11916b6b595421ce2ece10f7aa40757cc4937c0c#commitcomment-6792287
* wstream: document default value for 'maxmem'Thiago de Arruda2014-07-17
|
* move assert.h include out of vim.hBrandon Coleman2014-07-09
|
* wstream: Make wstream_write consider the return value from uv_writeThiago de Arruda2014-06-24
|
* wstream: Use a default value of 10mb for `maxmem` when 0 is passedThiago de Arruda2014-06-24
|
* wstream: Refactor buffer memory managementThiago de Arruda2014-06-24
| | | | | - Extract code to release WBuffer instances into `release_wbuffer` - Fix memory leak when wstream_write returns false
* wstream: Refactor wstream_new_buffer/wstream_writeThiago de Arruda2014-06-18
| | | | | | | | - Removed 'copy' parameter from `wstream_new_buffer`. Callers simply pass a copy of the buffer if required. - Added a callback parameter, which is used to notify callers when the data is successfully written. The callback is also used to free the buffer(if required) and is compatible with `free` from the standard library.
* wstream: Change wstream_write failure behaviorThiago de Arruda2014-06-17
| | | | | | | | | | | 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.
* Fix some stylesZyX2014-06-02
|
* Add automatic generation of headersZyX2014-06-02
| | | | | | | | | | | | | | | | | - The 'stripdecls.py' script replaces declarations in all headers by includes to generated headers. `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'` was used for this. - Add and integrate gendeclarations.lua into the build system to generate the required includes. - Add -Wno-unused-function - Made a bunch of old-style definitions ANSI This adds a requirement: all type and structure definitions must be present before INCLUDE_GENERATED_DECLARATIONS-protected include. Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is the only exception.
* Move documentation from function declarations to definitionsZyX2014-06-02
| | | | Uses a perl script to move it (scripts/movedocs.pl)
* WStream: Refactor: Use reference count for memory managementThiago de Arruda2014-05-28
| | | | | | | Now `wstream_write` receives pointers for WBuffer objects(created with wstream_new_buffer), which stores a reference count to determine when it's safe the free the buffer. This was done to enable writing of the same buffer to multiple WStream instances
* Refactor: Use size_t for {w,r}streams.cThiago de Arruda2014-05-28
|
* Introduce nvim namespace: Fix project-local includes.Eliseo Martínez2014-05-15
| | | | Prepend 'nvim/' in all project-local (non-system) includes.
* Introduce nvim namespace: Move files.Eliseo Martínez2014-05-15
Move files from src/ to src/nvim/. - src/nvim/ becomes the new root dir for nvim executable sources. - src/libnvim/ is planned to become root dir of the neovim library.