refactor(api): use an arena for mappings

This commit is contained in:
bfredl
2024-02-17 20:31:21 +01:00
parent b12d193b4a
commit f25fcc68a3
16 changed files with 172 additions and 90 deletions

View File

@ -905,7 +905,7 @@ Integer nvim_buf_get_changedtick(Buffer buffer, Error *err)
/// @param[out] err Error details, if any
/// @returns Array of |maparg()|-like dictionaries describing mappings.
/// The "buffer" key holds the associated buffer handle.
ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Error *err)
ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Arena *arena, Error *err)
FUNC_API_SINCE(3)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@ -914,7 +914,7 @@ ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Error *err)
return (Array)ARRAY_DICT_INIT;
}
return keymap_array(mode, buf);
return keymap_array(mode, buf, arena);
}
/// Sets a buffer-local |mapping| for the given mode.