]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4086: "cctx" argument of find_func_even_dead() is unused v8.2.4086
authorBram Moolenaar <Bram@vim.org>
Thu, 13 Jan 2022 21:15:21 +0000 (21:15 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 13 Jan 2022 21:15:21 +0000 (21:15 +0000)
Problem:    "cctx" argument of find_func_even_dead() is unused.
Solution:   Remove the argument.

12 files changed:
src/evalfunc.c
src/evalvars.c
src/proto/userfunc.pro
src/testing.c
src/userfunc.c
src/version.c
src/vim9compile.c
src/vim9execute.c
src/vim9expr.c
src/vim9instr.c
src/vim9script.c
src/vim9type.c

index 3905740e1d1d29b6756cd712196a38d3f278128b..f44207dff0fa9f5e259e330e66c949daa5345843 100644 (file)
@@ -4117,7 +4117,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
        semsg(_(e_invalid_argument_str), use_string ? tv_get_string(&argvars[0]) : s);
     // Don't check an autoload name for existence here.
     else if (trans_name != NULL && (is_funcref
-                        ? find_func(trans_name, is_global, NULL) == NULL
+                        ? find_func(trans_name, is_global) == NULL
                         : !translated_function_exists(trans_name, is_global)))
        semsg(_(e_unknown_function_str_2), s);
     else
@@ -4245,7 +4245,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
                }
                else if (is_funcref)
                {
-                   pt->pt_func = find_func(trans_name, is_global, NULL);
+                   pt->pt_func = find_func(trans_name, is_global);
                    func_ptr_ref(pt->pt_func);
                    vim_free(name);
                }
index d111b80ff806746f8b43b0311b89705a85d3a001..15999bc7460c2765b8ea5d3b9d4eeaf7ccb588bb 100644 (file)
@@ -2727,7 +2727,7 @@ eval_variable(
        }
        else if (in_vim9script() && (flags & EVAL_VAR_NO_FUNC) == 0)
        {
-           ufunc_T *ufunc = find_func(name, FALSE, NULL);
+           ufunc_T *ufunc = find_func(name, FALSE);
 
            // In Vim9 script we can get a function reference by using the
            // function name.
@@ -3063,7 +3063,7 @@ lookup_scriptitem(
                is_global = TRUE;
                fname = name + 2;
            }
-           if (find_func(fname, is_global, NULL) != NULL)
+           if (find_func(fname, is_global) != NULL)
                res = OK;
        }
     }
index 6b054ffe61c50b6ea4f1054c27a800e2a662d36e..416a33bed3cadedd17b2740d2d90b39668f7d499 100644 (file)
@@ -8,8 +8,8 @@ char_u *deref_func_name(char_u *name, int *lenp, partial_T **partialp, type_T **
 void emsg_funcname(char *ermsg, char_u *name);
 int get_func_tv(char_u *name, int len, typval_T *rettv, char_u **arg, evalarg_T *evalarg, funcexe_T *funcexe);
 char_u *fname_trans_sid(char_u *name, char_u *fname_buf, char_u **tofree, int *error);
-ufunc_T *find_func_even_dead(char_u *name, int is_global, cctx_T *cctx);
-ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx);
+ufunc_T *find_func_even_dead(char_u *name, int is_global);
+ufunc_T *find_func(char_u *name, int is_global);
 int func_is_global(ufunc_T *ufunc);
 int func_name_refcount(char_u *name);
 void func_clear_free(ufunc_T *fp, int force);
index f401863adb4cebd254f5b62cb5d32930e97e0a57..eef5e0d768c6ca0842af32a64b4187a5275699f3 100644 (file)
@@ -1113,7 +1113,7 @@ f_test_refcount(typval_T *argvars, typval_T *rettv)
            {
                ufunc_T *fp;
 
-               fp = find_func(argvars[0].vval.v_string, FALSE, NULL);
+               fp = find_func(argvars[0].vval.v_string, FALSE);
                if (fp != NULL)
                    retval = fp->uf_refcount;
            }
index fc6cea38ced7ac0ae063c1e1b57c932923969748..1dd5612b920e59bbb39878c18b573174785cd084 100644 (file)
@@ -1934,7 +1934,7 @@ find_func_with_prefix(char_u *name, int sid)
  * Return NULL for unknown function.
  */
     ufunc_T *
-find_func_even_dead(char_u *name, int is_global, cctx_T *cctx UNUSED)
+find_func_even_dead(char_u *name, int is_global)
 {
     hashitem_T *hi;
     ufunc_T    *func;
@@ -1970,9 +1970,9 @@ find_func_even_dead(char_u *name, int is_global, cctx_T *cctx UNUSED)
  * Return NULL for unknown or dead function.
  */
     ufunc_T *
-find_func(char_u *name, int is_global, cctx_T *cctx)
+find_func(char_u *name, int is_global)
 {
-    ufunc_T    *fp = find_func_even_dead(name, is_global, cctx);
+    ufunc_T    *fp = find_func_even_dead(name, is_global);
 
     if (fp != NULL && (fp->uf_flags & FC_DEAD) == 0)
        return fp;
@@ -2343,7 +2343,7 @@ func_clear_free(ufunc_T *fp, int force)
     int
 copy_func(char_u *lambda, char_u *global, ectx_T *ectx)
 {
-    ufunc_T *ufunc = find_func_even_dead(lambda, TRUE, NULL);
+    ufunc_T *ufunc = find_func_even_dead(lambda, TRUE);
     ufunc_T *fp = NULL;
 
     if (ufunc == NULL)
@@ -2352,7 +2352,7 @@ copy_func(char_u *lambda, char_u *global, ectx_T *ectx)
        return FAIL;
     }
 
-    fp = find_func(global, TRUE, NULL);
+    fp = find_func(global, TRUE);
     if (fp != NULL)
     {
        // TODO: handle ! to overwrite
@@ -3413,7 +3413,7 @@ call_func(
             * User defined function.
             */
            if (fp == NULL)
-               fp = find_func(rfname, is_global, NULL);
+               fp = find_func(rfname, is_global);
 
            // Trigger FuncUndefined event, may load the function.
            if (fp == NULL
@@ -3422,13 +3422,13 @@ call_func(
                    && !aborting())
            {
                // executed an autocommand, search for the function again
-               fp = find_func(rfname, is_global, NULL);
+               fp = find_func(rfname, is_global);
            }
            // Try loading a package.
            if (fp == NULL && script_autoload(rfname, TRUE) && !aborting())
            {
                // loaded a package, search for the function again
-               fp = find_func(rfname, is_global, NULL);
+               fp = find_func(rfname, is_global);
            }
            if (fp == NULL)
            {
@@ -3437,7 +3437,7 @@ call_func(
                // If using Vim9 script try not local to the script.
                // Don't do this if the name starts with "s:".
                if (p != NULL && (funcname[0] != 's' || funcname[1] != ':'))
-                   fp = find_func(p, is_global, NULL);
+                   fp = find_func(p, is_global);
            }
 
            if (fp != NULL && (fp->uf_flags & FC_DELETED))
@@ -4180,7 +4180,7 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
            *p = NUL;
        if (!eap->skip && !got_int)
        {
-           fp = find_func(name, is_global, NULL);
+           fp = find_func(name, is_global);
            if (fp == NULL && ASCII_ISUPPER(*eap->arg))
            {
                char_u *up = untrans_function_name(name);
@@ -4188,7 +4188,7 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
                // With Vim9 script the name was made script-local, if not
                // found try again with the original name.
                if (up != NULL)
-                   fp = find_func(up, FALSE, NULL);
+                   fp = find_func(up, FALSE);
            }
 
            if (fp != NULL)
@@ -4403,7 +4403,7 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
        {
            if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL)
                emsg(_(e_dictionary_entry_already_exists));
-           else if (name != NULL && find_func(name, is_global, NULL) != NULL)
+           else if (name != NULL && find_func(name, is_global) != NULL)
                emsg_funcname(e_function_str_already_exists_add_bang_to_replace, name);
        }
 
@@ -4437,7 +4437,7 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
            goto erret;
        }
 
-       fp = find_func_even_dead(name, is_global, NULL);
+       fp = find_func_even_dead(name, is_global);
        if (vim9script)
        {
            char_u *uname = untrans_function_name(name);
@@ -4792,7 +4792,7 @@ translated_function_exists(char_u *name, int is_global)
 {
     if (builtin_function(name, -1))
        return has_internal_func(name);
-    return find_func(name, is_global, NULL) != NULL;
+    return find_func(name, is_global) != NULL;
 }
 
 /*
@@ -4939,7 +4939,7 @@ ex_delfunction(exarg_T *eap)
        return;
     }
     if (!eap->skip)
-       fp = find_func(name, is_global, NULL);
+       fp = find_func(name, is_global);
     vim_free(name);
 
     if (!eap->skip)
@@ -4998,7 +4998,7 @@ func_unref(char_u *name)
 
     if (name == NULL || !func_name_refcount(name))
        return;
-    fp = find_func(name, FALSE, NULL);
+    fp = find_func(name, FALSE);
     if (fp == NULL && numbered_function(name))
     {
 #ifdef EXITFREE
@@ -5039,7 +5039,7 @@ func_ref(char_u *name)
 
     if (name == NULL || !func_name_refcount(name))
        return;
-    fp = find_func(name, FALSE, NULL);
+    fp = find_func(name, FALSE);
     if (fp != NULL)
        ++fp->uf_refcount;
     else if (numbered_function(name))
@@ -5534,7 +5534,7 @@ make_partial(dict_T *selfdict_in, typval_T *rettv)
                                              : rettv->vval.v_partial->pt_name;
        // Translate "s:func" to the stored function name.
        fname = fname_trans_sid(fname, fname_buf, &tofree, &error);
-       fp = find_func(fname, FALSE, NULL);
+       fp = find_func(fname, FALSE);
        vim_free(tofree);
     }
 
@@ -5953,7 +5953,7 @@ set_ref_in_func(char_u *name, ufunc_T *fp_in, int copyID)
     if (fp_in == NULL)
     {
        fname = fname_trans_sid(name, fname_buf, &tofree, &error);
-       fp = find_func(fname, FALSE, NULL);
+       fp = find_func(fname, FALSE);
     }
     if (fp != NULL)
     {
index 5572303136aed0ea7389535064774428843a8243..728d2b8a7f7f14d82e27aa5d25e41a02af466cc4 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4086,
 /**/
     4085,
 /**/
index 7e4f99fb434a8c5ce850299dd363bf41bb2f4e3e..af11ba929e8e6a7e65a6189fdf51c5d6ecadccb8 100644 (file)
@@ -296,7 +296,7 @@ item_exists(char_u *name, size_t len, int cmd UNUSED, cctx_T *cctx)
        // valid command, such as ":split" versus "split()".
        // Skip "g:" before a function name.
        is_global = (name[0] == 'g' && name[1] == ':');
-       return find_func(is_global ? name + 2 : name, is_global, cctx) != NULL;
+       return find_func(is_global ? name + 2 : name, is_global) != NULL;
     }
     return FALSE;
 }
@@ -332,7 +332,7 @@ check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg)
                && (lookup_local(p, len, NULL, cctx) == OK
                    || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
            || find_imported(p, len, FALSE, cctx) != NULL
-           || (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
+           || (ufunc = find_func_even_dead(p, FALSE)) != NULL)
     {
        // A local or script-local function can shadow a global function.
        if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0
index ba810680c1df7c8d8abb49cf5a4365dec917f99a..c947d6a0ce110a5f1cb1b803cef114af09834b80 100644 (file)
@@ -1007,7 +1007,7 @@ call_by_name(
        return call_bfunc(func_idx, argcount, ectx);
     }
 
-    ufunc = find_func(name, FALSE, NULL);
+    ufunc = find_func(name, FALSE);
 
     if (ufunc == NULL)
     {
@@ -1015,7 +1015,7 @@ call_by_name(
 
        if (script_autoload(name, TRUE))
            // loaded a package, search for the function again
-           ufunc = find_func(name, FALSE, NULL);
+           ufunc = find_func(name, FALSE);
 
        if (vim9_aborting(prev_uncaught_emsg))
            return FAIL;  // bail out if loading the script caused an error
@@ -3319,7 +3319,7 @@ exec_instructions(ectx_T *ectx)
                    }
                    else
                    {
-                       ufunc = find_func(funcref->fr_func_name, FALSE, NULL);
+                       ufunc = find_func(funcref->fr_func_name, FALSE);
                    }
                    if (ufunc == NULL)
                    {
@@ -6039,14 +6039,14 @@ ex_disassemble(exarg_T *eap)
        return;
     }
 
-    ufunc = find_func(fname, is_global, NULL);
+    ufunc = find_func(fname, is_global);
     if (ufunc == NULL)
     {
        char_u *p = untrans_function_name(fname);
 
        if (p != NULL)
            // Try again without making it script-local.
-           ufunc = find_func(p, FALSE, NULL);
+           ufunc = find_func(p, FALSE);
     }
     vim_free(fname);
     if (ufunc == NULL)
index 400bad6fd6d6e60ec6d9c1891e3a734177491e30..39ce9fe72e4651627466e171c53e9ee8251c2f44 100644 (file)
@@ -350,7 +350,7 @@ compile_load_scriptvar(
     static int
 generate_funcref(cctx_T *cctx, char_u *name)
 {
-    ufunc_T *ufunc = find_func(name, FALSE, cctx);
+    ufunc_T *ufunc = find_func(name, FALSE);
 
     if (ufunc == NULL)
        return FAIL;
@@ -418,7 +418,7 @@ compile_load(
                case 'v': res = generate_LOADV(cctx, name, error);
                          break;
                case 's': if (is_expr && ASCII_ISUPPER(*name)
-                                      && find_func(name, FALSE, cctx) != NULL)
+                                      && find_func(name, FALSE) != NULL)
                              res = generate_funcref(cctx, name);
                          else
                              res = compile_load_scriptvar(cctx, name,
@@ -427,7 +427,7 @@ compile_load(
                case 'g': if (vim_strchr(name, AUTOLOAD_CHAR) == NULL)
                          {
                              if (is_expr && ASCII_ISUPPER(*name)
-                                      && find_func(name, FALSE, cctx) != NULL)
+                                      && find_func(name, FALSE) != NULL)
                                  res = generate_funcref(cctx, name);
                              else
                                  isn_type = ISN_LOADG;
@@ -779,7 +779,7 @@ compile_call(
     {
        // If we can find the function by name generate the right call.
        // Skip global functions here, a local funcref takes precedence.
-       ufunc = find_func(name, FALSE, cctx);
+       ufunc = find_func(name, FALSE);
        if (ufunc != NULL && !func_is_global(ufunc))
        {
            res = generate_CALL(cctx, ufunc, argcount);
index 48b22a6d761b128fe5f228da9fb56fe8caca5b8f..50572978a7949876440c7e9efeac915eaefe3e28 100644 (file)
@@ -2030,7 +2030,7 @@ delete_instr(isn_T *isn)
        case ISN_NEWFUNC:
            {
                char_u  *lambda = isn->isn_arg.newfunc.nf_lambda;
-               ufunc_T *ufunc = find_func_even_dead(lambda, TRUE, NULL);
+               ufunc_T *ufunc = find_func_even_dead(lambda, TRUE);
 
                if (ufunc != NULL)
                {
index 549c20f402bddcc70b44ed31509371f76899eb61..baf2019f523e72b04326401723462c91e99ad89a 100644 (file)
@@ -132,7 +132,7 @@ ex_vim9script(exarg_T *eap UNUSED)
     }
     si->sn_state = SN_STATE_HAD_COMMAND;
 
-    // Store the prefix with the script.  It isused to find exported functions.
+    // Store the prefix with the script, it is used to find exported functions.
     if (si->sn_autoload_prefix == NULL)
        si->sn_autoload_prefix = get_autoload_prefix(si);
 
@@ -712,7 +712,7 @@ find_exported(
            funcname[2] = (int)KE_SNR;
            sprintf((char *)funcname + 3, "%ld_%s", (long)sid, name);
        }
-       *ufunc = find_func(funcname, FALSE, NULL);
+       *ufunc = find_func(funcname, FALSE);
        if (funcname != buffer)
            vim_free(funcname);
 
index bf82b7d3ce18bdb79d5fc4162633afe9391f6540..5b85c8e53fcb8ff2c3971fd3618b3f8b89af7e60 100644 (file)
@@ -361,7 +361,7 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int flags)
                member_type = internal_func_ret_type(idx, 0, NULL);
            }
            else
-               ufunc = find_func(name, FALSE, NULL);
+               ufunc = find_func(name, FALSE);
        }
        if (ufunc != NULL)
        {