mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
refactor(api): use an arena for user commands
This commit is contained in:
@@ -1166,10 +1166,10 @@ err:
|
||||
/// @param[out] err Error details, if any.
|
||||
///
|
||||
/// @returns Map of maps describing commands.
|
||||
Dictionary nvim_get_commands(Dict(get_commands) *opts, Error *err)
|
||||
Dictionary nvim_get_commands(Dict(get_commands) *opts, Arena *arena, Error *err)
|
||||
FUNC_API_SINCE(4)
|
||||
{
|
||||
return nvim_buf_get_commands(-1, opts, err);
|
||||
return nvim_buf_get_commands(-1, opts, arena, err);
|
||||
}
|
||||
|
||||
/// Gets a map of buffer-local |user-commands|.
|
||||
@@ -1179,7 +1179,7 @@ Dictionary nvim_get_commands(Dict(get_commands) *opts, Error *err)
|
||||
/// @param[out] err Error details, if any.
|
||||
///
|
||||
/// @returns Map of maps describing commands.
|
||||
Dictionary nvim_buf_get_commands(Buffer buffer, Dict(get_commands) *opts, Error *err)
|
||||
Dictionary nvim_buf_get_commands(Buffer buffer, Dict(get_commands) *opts, Arena *arena, Error *err)
|
||||
FUNC_API_SINCE(4)
|
||||
{
|
||||
bool global = (buffer == -1);
|
||||
@@ -1192,12 +1192,12 @@ Dictionary nvim_buf_get_commands(Buffer buffer, Dict(get_commands) *opts, Error
|
||||
api_set_error(err, kErrorTypeValidation, "builtin=true not implemented");
|
||||
return (Dictionary)ARRAY_DICT_INIT;
|
||||
}
|
||||
return commands_array(NULL);
|
||||
return commands_array(NULL, arena);
|
||||
}
|
||||
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
if (opts->builtin || !buf) {
|
||||
return (Dictionary)ARRAY_DICT_INIT;
|
||||
}
|
||||
return commands_array(buf);
|
||||
return commands_array(buf, arena);
|
||||
}
|
||||
|
Reference in New Issue
Block a user