0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0067: ERROR_UNKNOWN clashes on some systems

Problem:    ERROR_UNKNOWN clashes on some systems.
Solution:   Rename ERROR_ to FCERR_. (Ola Söder, closes #5415)
This commit is contained in:
Bram Moolenaar
2019-12-31 21:27:13 +01:00
parent d2c946bacf
commit ef140544f6
4 changed files with 41 additions and 39 deletions

View File

@@ -976,14 +976,14 @@ call_internal_func(
i = find_internal_func(name);
if (i < 0)
return ERROR_UNKNOWN;
return FCERR_UNKNOWN;
if (argcount < global_functions[i].f_min_argc)
return ERROR_TOOFEW;
return FCERR_TOOFEW;
if (argcount > global_functions[i].f_max_argc)
return ERROR_TOOMANY;
return FCERR_TOOMANY;
argvars[argcount].v_type = VAR_UNKNOWN;
global_functions[i].f_func(argvars, rettv);
return ERROR_NONE;
return FCERR_NONE;
}
/*
@@ -1003,13 +1003,13 @@ call_internal_method(
fi = find_internal_func(name);
if (fi < 0)
return ERROR_UNKNOWN;
return FCERR_UNKNOWN;
if (global_functions[fi].f_argtype == 0)
return ERROR_NOTMETHOD;
return FCERR_NOTMETHOD;
if (argcount + 1 < global_functions[fi].f_min_argc)
return ERROR_TOOFEW;
return FCERR_TOOFEW;
if (argcount + 1 > global_functions[fi].f_max_argc)
return ERROR_TOOMANY;
return FCERR_TOOMANY;
if (global_functions[fi].f_argtype == FEARG_LAST)
{
@@ -1055,7 +1055,7 @@ call_internal_method(
argv[argcount + 1].v_type = VAR_UNKNOWN;
global_functions[fi].f_func(argv, rettv);
return ERROR_NONE;
return FCERR_NONE;
}
/*

View File

@@ -549,7 +549,7 @@ fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error)
if (eval_fname_sid(name)) // "<SID>" or "s:"
{
if (current_sctx.sc_sid <= 0)
*error = ERROR_SCRIPT;
*error = FCERR_SCRIPT;
else
{
sprintf((char *)fname_buf + 3, "%ld_",
@@ -566,7 +566,7 @@ fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error)
{
fname = alloc(i + STRLEN(name + llen) + 1);
if (fname == NULL)
*error = ERROR_OTHER;
*error = FCERR_OTHER;
else
{
*tofree = fname;
@@ -1482,7 +1482,7 @@ call_func(
funcexe_T *funcexe) // more arguments
{
int ret = FAIL;
int error = ERROR_NONE;
int error = FCERR_NONE;
int i;
ufunc_T *fp;
char_u fname_buf[FLEN_FIXED + 1];
@@ -1520,13 +1520,13 @@ call_func(
// When the dict was bound explicitly use the one from the partial.
if (partial->pt_dict != NULL && (selfdict == NULL || !partial->pt_auto))
selfdict = partial->pt_dict;
if (error == ERROR_NONE && partial->pt_argc > 0)
if (error == FCERR_NONE && partial->pt_argc > 0)
{
for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear)
{
if (argv_clear + argcount_in >= MAX_FUNC_ARGS)
{
error = ERROR_TOOMANY;
error = FCERR_TOOMANY;
goto theend;
}
copy_tv(&partial->pt_argv[argv_clear], &argv[argv_clear]);
@@ -1538,7 +1538,7 @@ call_func(
}
}
if (error == ERROR_NONE && funcexe->evaluate)
if (error == FCERR_NONE && funcexe->evaluate)
{
char_u *rfname = fname;
@@ -1548,7 +1548,7 @@ call_func(
rettv->v_type = VAR_NUMBER; // default rettv is number zero
rettv->vval.v_number = 0;
error = ERROR_UNKNOWN;
error = FCERR_UNKNOWN;
if (!builtin_function(rfname, -1))
{
@@ -1577,7 +1577,7 @@ call_func(
}
if (fp != NULL && (fp->uf_flags & FC_DELETED))
error = ERROR_DELETED;
error = FCERR_DELETED;
else if (fp != NULL)
{
if (funcexe->argv_func != NULL)
@@ -1598,11 +1598,11 @@ call_func(
if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL)
*funcexe->doesrange = TRUE;
if (argcount < fp->uf_args.ga_len - fp->uf_def_args.ga_len)
error = ERROR_TOOFEW;
error = FCERR_TOOFEW;
else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len)
error = ERROR_TOOMANY;
error = FCERR_TOOMANY;
else if ((fp->uf_flags & FC_DICT) && selfdict == NULL)
error = ERROR_DICT;
error = FCERR_DICT;
else
{
int did_save_redo = FALSE;
@@ -1630,7 +1630,7 @@ call_func(
if (did_save_redo)
restoreRedobuff(&save_redo);
restore_search_patterns();
error = ERROR_NONE;
error = FCERR_NONE;
}
}
}
@@ -1662,7 +1662,7 @@ call_func(
*/
update_force_abort();
}
if (error == ERROR_NONE)
if (error == FCERR_NONE)
ret = OK;
theend:
@@ -1674,31 +1674,31 @@ theend:
{
switch (error)
{
case ERROR_UNKNOWN:
case FCERR_UNKNOWN:
emsg_funcname(N_("E117: Unknown function: %s"), name);
break;
case ERROR_NOTMETHOD:
case FCERR_NOTMETHOD:
emsg_funcname(
N_("E276: Cannot use function as a method: %s"),
name);
break;
case ERROR_DELETED:
case FCERR_DELETED:
emsg_funcname(N_("E933: Function was deleted: %s"), name);
break;
case ERROR_TOOMANY:
case FCERR_TOOMANY:
emsg_funcname((char *)e_toomanyarg, name);
break;
case ERROR_TOOFEW:
case FCERR_TOOFEW:
emsg_funcname(
N_("E119: Not enough arguments for function: %s"),
name);
break;
case ERROR_SCRIPT:
case FCERR_SCRIPT:
emsg_funcname(
N_("E120: Using <SID> not in a script context: %s"),
name);
break;
case ERROR_DICT:
case FCERR_DICT:
emsg_funcname(
N_("E725: Calling dict function without Dictionary: %s"),
name);
@@ -3847,7 +3847,7 @@ set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID)
{
ufunc_T *fp = fp_in;
funccall_T *fc;
int error = ERROR_NONE;
int error = FCERR_NONE;
char_u fname_buf[FLEN_FIXED + 1];
char_u *tofree = NULL;
char_u *fname;

View File

@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
67,
/**/
66,
/**/

View File

@@ -2551,15 +2551,15 @@ typedef enum {
// be freed.
// errors for when calling a function
#define ERROR_UNKNOWN 0
#define ERROR_TOOMANY 1
#define ERROR_TOOFEW 2
#define ERROR_SCRIPT 3
#define ERROR_DICT 4
#define ERROR_NONE 5
#define ERROR_OTHER 6
#define ERROR_DELETED 7
#define ERROR_NOTMETHOD 8 // function cannot be used as a method
#define FCERR_UNKNOWN 0
#define FCERR_TOOMANY 1
#define FCERR_TOOFEW 2
#define FCERR_SCRIPT 3
#define FCERR_DICT 4
#define FCERR_NONE 5
#define FCERR_OTHER 6
#define FCERR_DELETED 7
#define FCERR_NOTMETHOD 8 // function cannot be used as a method
// flags for find_name_end()
#define FNE_INCL_BR 1 // include [] in name