aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/func_attr.h
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-02-20 13:44:50 +0100
committerbfredl <bjorn.linse@gmail.com>2024-02-21 11:58:28 +0100
commit3cc54586be7760652e8bad88cae82ce74ef9432e (patch)
treed39cab2ecf5fb8f8bfc44ecf40c6fb2efb13a241 /src/nvim/func_attr.h
parent9bb046d1be5aa9ba0482b2cad050b286d4b78978 (diff)
downloadrneovim-3cc54586be7760652e8bad88cae82ce74ef9432e.tar.gz
rneovim-3cc54586be7760652e8bad88cae82ce74ef9432e.tar.bz2
rneovim-3cc54586be7760652e8bad88cae82ce74ef9432e.zip
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).
Diffstat (limited to 'src/nvim/func_attr.h')
-rw-r--r--src/nvim/func_attr.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h
index d638fda531..43af880767 100644
--- a/src/nvim/func_attr.h
+++ b/src/nvim/func_attr.h
@@ -212,6 +212,8 @@
#if defined(DEFINE_FUNC_ATTRIBUTES) || defined(DEFINE_EMPTY_ATTRIBUTES)
/// Fast (non-deferred) API function.
# define FUNC_API_FAST
+/// Return value needs to be freed
+# define FUNC_API_RET_ALLOC
/// Internal C function not exposed in the RPC API.
# define FUNC_API_NOEXPORT
/// API function not exposed in Vimscript/eval.