mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
refactor(api): make freeing of return-value opt-in instead of opt out
As only a few API functions make use of explicit freeing of the return value, make it opt-in instead. The arena is always present under the hood, so `Arena *arena` arg now doesn't mean anything other than getting access to this arena. Also it is in principle possible to return an allocated value while still using the arena as scratch space for other stuff (unlikely, but there no reason to not allow it).
This commit is contained in:
@@ -18,8 +18,8 @@ struct MsgpackRpcRequestHandler {
|
||||
///< uv loop (the loop is run very frequently due to breakcheck).
|
||||
///< If "fast" is false, the function is deferred, i e the call will
|
||||
///< be put in the event queue, for safe handling later.
|
||||
bool arena_return; ///< return value is allocated in the arena (or statically)
|
||||
///< and should not be freed as such.
|
||||
bool ret_alloc; ///< return value is allocated and should be freed using api_free_object
|
||||
///< otherwise it uses arena and/or static memory
|
||||
};
|
||||
|
||||
extern const MsgpackRpcRequestHandler method_handlers[];
|
||||
|
Reference in New Issue
Block a user