aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/converter.c
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/lua/converter.c
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/lua/converter.c')
-rw-r--r--src/nvim/lua/converter.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c
index 21dd5139d7..735a75a6f1 100644
--- a/src/nvim/lua/converter.c
+++ b/src/nvim/lua/converter.c
@@ -385,12 +385,9 @@ nlua_pop_typval_table_processing_end:
break;
}
case LUA_TFUNCTION: {
- LuaCFunctionState *state = xmalloc(sizeof(LuaCFunctionState));
- state->lua_callable.func_ref = nlua_ref_global(lstate, -1);
+ LuaRef func = nlua_ref_global(lstate, -1);
- char *name = (char *)register_cfunc(&nlua_CFunction_func_call,
- &nlua_CFunction_func_free,
- state);
+ char *name = (char *)register_luafunc(func);
cur.tv->v_type = VAR_FUNC;
cur.tv->vval.v_string = xstrdup(name);
@@ -476,8 +473,8 @@ static bool typval_conv_special = false;
#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) { \
- nlua_pushref(lstate, ((LuaCFunctionState *)fp->uf_cb_state)->lua_callable.func_ref); \
+ if (fp != NULL && fp->uf_flags & FC_LUAREF) { \
+ nlua_pushref(lstate, fp->uf_luaref); \
} else { \
TYPVAL_ENCODE_CONV_NIL(tv); \
} \