aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/buffer.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-02-13 12:14:53 +0100
committerGitHub <noreply@github.com>2024-02-13 12:14:53 +0100
commitce5a9bfe7e537c81d34bd4a27fc6638f20114e67 (patch)
tree1eeeedcb0370d7c156f60ee53017149c8aac8c28 /src/nvim/api/buffer.c
parent89135cff030b06f60cd596a9ae81cd9583987517 (diff)
parent1a3a8d903e9705ce41867e1cbc629a85c7cb6252 (diff)
downloadrneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.tar.gz
rneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.tar.bz2
rneovim-ce5a9bfe7e537c81d34bd4a27fc6638f20114e67.zip
Merge pull request #27428 from bfredl/luarena
refactor(lua): use Arena when converting from lua stack to API args
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r--src/nvim/api/buffer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 183483b329..993e290b2d 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1227,8 +1227,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
/// @param fun Function to call inside the buffer (currently Lua callable
/// only)
/// @param[out] err Error details, if any
-/// @return Return value of function. NB: will deepcopy Lua values
-/// currently, use upvalues to send Lua references in and out.
+/// @return Return value of function.
Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
FUNC_API_SINCE(7)
FUNC_API_LUA_ONLY
@@ -1242,7 +1241,7 @@ Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
aucmd_prepbuf(&aco, buf);
Array args = ARRAY_DICT_INIT;
- Object res = nlua_call_ref(fun, NULL, args, true, err);
+ Object res = nlua_call_ref(fun, NULL, args, kRetLuaref, NULL, err);
aucmd_restbuf(&aco);
try_end(err);
@@ -1419,7 +1418,7 @@ static void push_linestr(lua_State *lstate, Array *a, const char *s, size_t len,
} else {
String str = STRING_INIT;
if (len > 0) {
- str = arena_string(arena, cbuf_as_string((char *)s, len));
+ str = CBUF_TO_ARENA_STR(arena, s, len);
if (replace_nl) {
// Vim represents NULs as NLs, but this may confuse clients.
strchrsub(str.data, '\n', '\0');