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:
ii14
2023-04-06 22:39:50 +02:00
committed by GitHub
parent 0bc3238504
commit 7190dba017
21 changed files with 152 additions and 154 deletions

View File

@@ -861,7 +861,7 @@ char *uc_validate_name(char *name)
///
/// @return OK if the command is created, FAIL otherwise.
int uc_add_command(char *name, size_t name_len, const char *rep, uint32_t argt, int64_t def,
int flags, int compl, char *compl_arg, LuaRef compl_luaref,
int flags, int context, char *compl_arg, LuaRef compl_luaref,
LuaRef preview_luaref, cmd_addr_T addr_type, LuaRef luaref, bool force)
FUNC_ATTR_NONNULL_ARG(1, 3)
{
@@ -944,7 +944,7 @@ int uc_add_command(char *name, size_t name_len, const char *rep, uint32_t argt,
cmd->uc_rep = rep_buf;
cmd->uc_argt = argt;
cmd->uc_def = def;
cmd->uc_compl = compl;
cmd->uc_compl = context;
cmd->uc_script_ctx = current_sctx;
cmd->uc_script_ctx.sc_lnum += SOURCING_LNUM;
nlua_set_sctx(&cmd->uc_script_ctx);
@@ -974,7 +974,7 @@ void ex_command(exarg_T *eap)
uint32_t argt = 0;
long def = -1;
int flags = 0;
int compl = EXPAND_NOTHING;
int context = EXPAND_NOTHING;
char *compl_arg = NULL;
cmd_addr_T addr_type_arg = ADDR_NONE;
int has_attr = (eap->arg[0] == '-');
@@ -986,7 +986,7 @@ void ex_command(exarg_T *eap)
while (*p == '-') {
p++;
end = skiptowhite(p);
if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, &compl_arg,
if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &context, &compl_arg,
&addr_type_arg) == FAIL) {
goto theend;
}
@@ -1011,10 +1011,10 @@ void ex_command(exarg_T *eap)
emsg(_("E183: User defined commands must start with an uppercase letter"));
} else if (name_len <= 4 && strncmp(name, "Next", name_len) == 0) {
emsg(_("E841: Reserved name, cannot be used for user defined command"));
} else if (compl > 0 && (argt & EX_EXTRA) == 0) {
} else if (context > 0 && (argt & EX_EXTRA) == 0) {
emsg(_(e_complete_used_without_allowing_arguments));
} else {
uc_add_command(name, name_len, p, argt, def, flags, compl, compl_arg, LUA_NOREF, LUA_NOREF,
uc_add_command(name, name_len, p, argt, def, flags, context, compl_arg, LUA_NOREF, LUA_NOREF,
addr_type_arg, LUA_NOREF, eap->forceit);
return; // success