mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
refactor(api): use an arena for mappings
This commit is contained in:
@@ -2327,11 +2327,9 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview)
|
||||
/// String representation of a Lua function reference
|
||||
///
|
||||
/// @return Allocated string
|
||||
char *nlua_funcref_str(LuaRef ref)
|
||||
char *nlua_funcref_str(LuaRef ref, Arena *arena)
|
||||
{
|
||||
lua_State *const lstate = global_lstate;
|
||||
StringBuilder str = KV_INITIAL_VALUE;
|
||||
kv_resize(str, 16);
|
||||
|
||||
if (!lua_checkstack(lstate, 1)) {
|
||||
goto plain;
|
||||
@@ -2345,14 +2343,13 @@ char *nlua_funcref_str(LuaRef ref)
|
||||
lua_Debug ar;
|
||||
if (lua_getinfo(lstate, ">S", &ar) && *ar.source == '@' && ar.linedefined >= 0) {
|
||||
char *src = home_replace_save(NULL, ar.source + 1);
|
||||
kv_printf(str, "<Lua %d: %s:%d>", ref, src, ar.linedefined);
|
||||
String str = arena_printf(arena, "<Lua %d: %s:%d>", ref, src, ar.linedefined);
|
||||
xfree(src);
|
||||
return str.items;
|
||||
return str.data;
|
||||
}
|
||||
|
||||
plain:
|
||||
kv_printf(str, "<Lua %d>", ref);
|
||||
return str.items;
|
||||
plain: {}
|
||||
return arena_printf(arena, "<Lua %d>", ref).data;
|
||||
}
|
||||
|
||||
/// Execute the vim._defaults module to set up default mappings and autocommands
|
||||
|
Reference in New Issue
Block a user