]> granicus.if.org Git - vim/commitdiff
patch 8.2.0067: ERROR_UNKNOWN clashes on some systems v8.2.0067
authorBram Moolenaar <Bram@vim.org>
Tue, 31 Dec 2019 20:27:13 +0000 (21:27 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 31 Dec 2019 20:27:13 +0000 (21:27 +0100)
Problem:    ERROR_UNKNOWN clashes on some systems.
Solution:   Rename ERROR_ to FCERR_. (Ola Söder, closes #5415)

src/evalfunc.c
src/userfunc.c
src/version.c
src/vim.h

index 610eca46b84249a588f1f6c53ebd72cce10caf4a..489ab424a941ea8011487035934bbb6670d56dd5 100644 (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;
 }
 
 /*
index 56dbf9e71f997979cdf63279a8736525ecd96577..a8bc34ae81603c5c4d82f1fd5747aa5c129b0c01 100644 (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;
index b86424ffc40036d4979e796d039dbea13c8df281..432ae4d9225ea39d95c8a0a809b7f7f936b3d963 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    67,
 /**/
     66,
 /**/
index c4c649c3dd2d2c8460792e6b2fa790c2680268e8..d69272edd983deb9bacebf10510796f5276230e6 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -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