aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-09-07 09:08:05 +0200
committerGitHub <noreply@github.com>2022-09-07 09:08:05 +0200
commitff9d2b17fb0f538b2b6d58c33c1568c699b0bb0e (patch)
tree263d5b6960716d35dbb7800f9e5180130d668fc8 /src/nvim/api
parentfd1595514b747d8b083f78007579d869ccfbe89c (diff)
parentdb9b8b08e74ae8cfb08960eca0a7273538ebcdf1 (diff)
downloadrneovim-ff9d2b17fb0f538b2b6d58c33c1568c699b0bb0e.tar.gz
rneovim-ff9d2b17fb0f538b2b6d58c33c1568c699b0bb0e.tar.bz2
rneovim-ff9d2b17fb0f538b2b6d58c33c1568c699b0bb0e.zip
Merge pull request #20100 from bfredl/luafunc
refactor(typval): change FC_CFUNC abstraction into FC_LUAREF
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/private/converter.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index 8724ef4432..b6b3c83f3c 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -65,8 +65,8 @@ typedef struct {
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
do { \
ufunc_T *fp = find_func(fun); \
- if (fp != NULL && fp->uf_cb == nlua_CFunction_func_call) { \
- LuaRef ref = api_new_luaref(((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref); \
+ if (fp != NULL && (fp->uf_flags & FC_LUAREF)) { \
+ LuaRef ref = api_new_luaref(fp->uf_luaref); \
kvi_push(edata->stack, LUAREF_OBJ(ref)); \
} else { \
TYPVAL_ENCODE_CONV_NIL(tv); \
@@ -351,10 +351,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
}
case kObjectTypeLuaRef: {
- LuaCFunctionState *state = xmalloc(sizeof(LuaCFunctionState));
- state->lua_callable.func_ref = api_new_luaref(obj.data.luaref);
- char *name =
- (char *)register_cfunc(&nlua_CFunction_func_call, &nlua_CFunction_func_free, state);
+ char *name = (char *)register_luafunc(api_new_luaref(obj.data.luaref));
tv->v_type = VAR_FUNC;
tv->vval.v_string = xstrdup(name);
break;