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

@@ -77,15 +77,16 @@ void nvim_win_set_buf(Window window, Buffer buffer, Error *err)
/// @param window Window handle, or 0 for current window
/// @param[out] err Error details, if any
/// @return (row, col) tuple
ArrayOf(Integer, 2) nvim_win_get_cursor(Window window, Error *err)
ArrayOf(Integer, 2) nvim_win_get_cursor(Window window, Arena *arena, Error *err)
FUNC_API_SINCE(1)
{
Array rv = ARRAY_DICT_INIT;
win_T *win = find_window_by_handle(window, err);
if (win) {
ADD(rv, INTEGER_OBJ(win->w_cursor.lnum));
ADD(rv, INTEGER_OBJ(win->w_cursor.col));
rv = arena_array(arena, 2);
ADD_C(rv, INTEGER_OBJ(win->w_cursor.lnum));
ADD_C(rv, INTEGER_OBJ(win->w_cursor.col));
}
return rv;