Skip to content

Commit ef14054

Browse files
committed
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)
1 parent d2c946b commit ef14054

4 files changed

Lines changed: 41 additions & 39 deletions

File tree

src/evalfunc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -976,14 +976,14 @@ call_internal_func(
976976

977977
i = find_internal_func(name);
978978
if (i < 0)
979-
return ERROR_UNKNOWN;
979+
return FCERR_UNKNOWN;
980980
if (argcount < global_functions[i].f_min_argc)
981-
return ERROR_TOOFEW;
981+
return FCERR_TOOFEW;
982982
if (argcount > global_functions[i].f_max_argc)
983-
return ERROR_TOOMANY;
983+
return FCERR_TOOMANY;
984984
argvars[argcount].v_type = VAR_UNKNOWN;
985985
global_functions[i].f_func(argvars, rettv);
986-
return ERROR_NONE;
986+
return FCERR_NONE;
987987
}
988988

989989
/*
@@ -1003,13 +1003,13 @@ call_internal_method(
10031003

10041004
fi = find_internal_func(name);
10051005
if (fi < 0)
1006-
return ERROR_UNKNOWN;
1006+
return FCERR_UNKNOWN;
10071007
if (global_functions[fi].f_argtype == 0)
1008-
return ERROR_NOTMETHOD;
1008+
return FCERR_NOTMETHOD;
10091009
if (argcount + 1 < global_functions[fi].f_min_argc)
1010-
return ERROR_TOOFEW;
1010+
return FCERR_TOOFEW;
10111011
if (argcount + 1 > global_functions[fi].f_max_argc)
1012-
return ERROR_TOOMANY;
1012+
return FCERR_TOOMANY;
10131013

10141014
if (global_functions[fi].f_argtype == FEARG_LAST)
10151015
{
@@ -1055,7 +1055,7 @@ call_internal_method(
10551055
argv[argcount + 1].v_type = VAR_UNKNOWN;
10561056

10571057
global_functions[fi].f_func(argv, rettv);
1058-
return ERROR_NONE;
1058+
return FCERR_NONE;
10591059
}
10601060

10611061
/*

src/userfunc.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error)
549549
if (eval_fname_sid(name)) // "<SID>" or "s:"
550550
{
551551
if (current_sctx.sc_sid <= 0)
552-
*error = ERROR_SCRIPT;
552+
*error = FCERR_SCRIPT;
553553
else
554554
{
555555
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)
566566
{
567567
fname = alloc(i + STRLEN(name + llen) + 1);
568568
if (fname == NULL)
569-
*error = ERROR_OTHER;
569+
*error = FCERR_OTHER;
570570
else
571571
{
572572
*tofree = fname;
@@ -1482,7 +1482,7 @@ call_func(
14821482
funcexe_T *funcexe) // more arguments
14831483
{
14841484
int ret = FAIL;
1485-
int error = ERROR_NONE;
1485+
int error = FCERR_NONE;
14861486
int i;
14871487
ufunc_T *fp;
14881488
char_u fname_buf[FLEN_FIXED + 1];
@@ -1520,13 +1520,13 @@ call_func(
15201520
// When the dict was bound explicitly use the one from the partial.
15211521
if (partial->pt_dict != NULL && (selfdict == NULL || !partial->pt_auto))
15221522
selfdict = partial->pt_dict;
1523-
if (error == ERROR_NONE && partial->pt_argc > 0)
1523+
if (error == FCERR_NONE && partial->pt_argc > 0)
15241524
{
15251525
for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear)
15261526
{
15271527
if (argv_clear + argcount_in >= MAX_FUNC_ARGS)
15281528
{
1529-
error = ERROR_TOOMANY;
1529+
error = FCERR_TOOMANY;
15301530
goto theend;
15311531
}
15321532
copy_tv(&partial->pt_argv[argv_clear], &argv[argv_clear]);
@@ -1538,7 +1538,7 @@ call_func(
15381538
}
15391539
}
15401540

1541-
if (error == ERROR_NONE && funcexe->evaluate)
1541+
if (error == FCERR_NONE && funcexe->evaluate)
15421542
{
15431543
char_u *rfname = fname;
15441544

@@ -1548,7 +1548,7 @@ call_func(
15481548

15491549
rettv->v_type = VAR_NUMBER; // default rettv is number zero
15501550
rettv->vval.v_number = 0;
1551-
error = ERROR_UNKNOWN;
1551+
error = FCERR_UNKNOWN;
15521552

15531553
if (!builtin_function(rfname, -1))
15541554
{
@@ -1577,7 +1577,7 @@ call_func(
15771577
}
15781578

15791579
if (fp != NULL && (fp->uf_flags & FC_DELETED))
1580-
error = ERROR_DELETED;
1580+
error = FCERR_DELETED;
15811581
else if (fp != NULL)
15821582
{
15831583
if (funcexe->argv_func != NULL)
@@ -1598,11 +1598,11 @@ call_func(
15981598
if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL)
15991599
*funcexe->doesrange = TRUE;
16001600
if (argcount < fp->uf_args.ga_len - fp->uf_def_args.ga_len)
1601-
error = ERROR_TOOFEW;
1601+
error = FCERR_TOOFEW;
16021602
else if (!fp->uf_varargs && argcount > fp->uf_args.ga_len)
1603-
error = ERROR_TOOMANY;
1603+
error = FCERR_TOOMANY;
16041604
else if ((fp->uf_flags & FC_DICT) && selfdict == NULL)
1605-
error = ERROR_DICT;
1605+
error = FCERR_DICT;
16061606
else
16071607
{
16081608
int did_save_redo = FALSE;
@@ -1630,7 +1630,7 @@ call_func(
16301630
if (did_save_redo)
16311631
restoreRedobuff(&save_redo);
16321632
restore_search_patterns();
1633-
error = ERROR_NONE;
1633+
error = FCERR_NONE;
16341634
}
16351635
}
16361636
}
@@ -1662,7 +1662,7 @@ call_func(
16621662
*/
16631663
update_force_abort();
16641664
}
1665-
if (error == ERROR_NONE)
1665+
if (error == FCERR_NONE)
16661666
ret = OK;
16671667

16681668
theend:
@@ -1674,31 +1674,31 @@ call_func(
16741674
{
16751675
switch (error)
16761676
{
1677-
case ERROR_UNKNOWN:
1677+
case FCERR_UNKNOWN:
16781678
emsg_funcname(N_("E117: Unknown function: %s"), name);
16791679
break;
1680-
case ERROR_NOTMETHOD:
1680+
case FCERR_NOTMETHOD:
16811681
emsg_funcname(
16821682
N_("E276: Cannot use function as a method: %s"),
16831683
name);
16841684
break;
1685-
case ERROR_DELETED:
1685+
case FCERR_DELETED:
16861686
emsg_funcname(N_("E933: Function was deleted: %s"), name);
16871687
break;
1688-
case ERROR_TOOMANY:
1688+
case FCERR_TOOMANY:
16891689
emsg_funcname((char *)e_toomanyarg, name);
16901690
break;
1691-
case ERROR_TOOFEW:
1691+
case FCERR_TOOFEW:
16921692
emsg_funcname(
16931693
N_("E119: Not enough arguments for function: %s"),
16941694
name);
16951695
break;
1696-
case ERROR_SCRIPT:
1696+
case FCERR_SCRIPT:
16971697
emsg_funcname(
16981698
N_("E120: Using <SID> not in a script context: %s"),
16991699
name);
17001700
break;
1701-
case ERROR_DICT:
1701+
case FCERR_DICT:
17021702
emsg_funcname(
17031703
N_("E725: Calling dict function without Dictionary: %s"),
17041704
name);
@@ -3847,7 +3847,7 @@ set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID)
38473847
{
38483848
ufunc_T *fp = fp_in;
38493849
funccall_T *fc;
3850-
int error = ERROR_NONE;
3850+
int error = FCERR_NONE;
38513851
char_u fname_buf[FLEN_FIXED + 1];
38523852
char_u *tofree = NULL;
38533853
char_u *fname;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
67,
745747
/**/
746748
66,
747749
/**/

src/vim.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,15 +2551,15 @@ typedef enum {
25512551
// be freed.
25522552

25532553
// errors for when calling a function
2554-
#define ERROR_UNKNOWN 0
2555-
#define ERROR_TOOMANY 1
2556-
#define ERROR_TOOFEW 2
2557-
#define ERROR_SCRIPT 3
2558-
#define ERROR_DICT 4
2559-
#define ERROR_NONE 5
2560-
#define ERROR_OTHER 6
2561-
#define ERROR_DELETED 7
2562-
#define ERROR_NOTMETHOD 8 // function cannot be used as a method
2554+
#define FCERR_UNKNOWN 0
2555+
#define FCERR_TOOMANY 1
2556+
#define FCERR_TOOFEW 2
2557+
#define FCERR_SCRIPT 3
2558+
#define FCERR_DICT 4
2559+
#define FCERR_NONE 5
2560+
#define FCERR_OTHER 6
2561+
#define FCERR_DELETED 7
2562+
#define FCERR_NOTMETHOD 8 // function cannot be used as a method
25632563

25642564
// flags for find_name_end()
25652565
#define FNE_INCL_BR 1 // include [] in name

0 commit comments

Comments
 (0)