mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
refactor: remove use of reserved c++ keywords
libnvim couldn't be easily used in C++ due to the use of reserved keywords. Additionally, add explicit casts to *alloc function calls used in inline functions, as C++ doesn't allow implicit casts from void pointers.
This commit is contained in:
@@ -1015,7 +1015,7 @@ void create_user_command(uint64_t channel_id, String name, Object command, Dict(
|
||||
uint32_t argt = 0;
|
||||
int64_t def = -1;
|
||||
cmd_addr_T addr_type_arg = ADDR_NONE;
|
||||
int compl = EXPAND_NOTHING;
|
||||
int context = EXPAND_NOTHING;
|
||||
char *compl_arg = NULL;
|
||||
const char *rep = NULL;
|
||||
LuaRef luaref = LUA_NOREF;
|
||||
@@ -1161,11 +1161,11 @@ void create_user_command(uint64_t channel_id, String name, Object command, Dict(
|
||||
}
|
||||
|
||||
if (opts->complete.type == kObjectTypeLuaRef) {
|
||||
compl = EXPAND_USER_LUA;
|
||||
context = EXPAND_USER_LUA;
|
||||
compl_luaref = api_new_luaref(opts->complete.data.luaref);
|
||||
} else if (opts->complete.type == kObjectTypeString) {
|
||||
VALIDATE_S(OK == parse_compl_arg(opts->complete.data.string.data,
|
||||
(int)opts->complete.data.string.size, &compl, &argt,
|
||||
(int)opts->complete.data.string.size, &context, &argt,
|
||||
&compl_arg),
|
||||
"complete", opts->complete.data.string.data, {
|
||||
goto err;
|
||||
@@ -1204,8 +1204,8 @@ void create_user_command(uint64_t channel_id, String name, Object command, Dict(
|
||||
}
|
||||
|
||||
WITH_SCRIPT_CONTEXT(channel_id, {
|
||||
if (uc_add_command(name.data, name.size, rep, argt, def, flags, compl, compl_arg, compl_luaref,
|
||||
preview_luaref, addr_type_arg, luaref, force) != OK) {
|
||||
if (uc_add_command(name.data, name.size, rep, argt, def, flags, context, compl_arg,
|
||||
compl_luaref, preview_luaref, addr_type_arg, luaref, force) != OK) {
|
||||
api_set_error(err, kErrorTypeException, "Failed to create user command");
|
||||
// Do not goto err, since uc_add_command now owns luaref, compl_luaref, and compl_arg
|
||||
}
|
||||
|
Reference in New Issue
Block a user