Problem: "cctx" argument of find_func_even_dead() is unused.
Solution: Remove the argument.
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
}
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);
}
}
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.
is_global = TRUE;
fname = name + 2;
}
- if (find_func(fname, is_global, NULL) != NULL)
+ if (find_func(fname, is_global) != NULL)
res = OK;
}
}
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);
{
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;
}
* 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;
* 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;
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)
return FAIL;
}
- fp = find_func(global, TRUE, NULL);
+ fp = find_func(global, TRUE);
if (fp != NULL)
{
// TODO: handle ! to overwrite
* 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
&& !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)
{
// 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))
*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);
// 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)
{
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);
}
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);
{
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;
}
/*
return;
}
if (!eap->skip)
- fp = find_func(name, is_global, NULL);
+ fp = find_func(name, is_global);
vim_free(name);
if (!eap->skip)
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
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))
: 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);
}
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)
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4086,
/**/
4085,
/**/
// 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;
}
&& (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
return call_bfunc(func_idx, argcount, ectx);
}
- ufunc = find_func(name, FALSE, NULL);
+ ufunc = find_func(name, FALSE);
if (ufunc == NULL)
{
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
}
else
{
- ufunc = find_func(funcref->fr_func_name, FALSE, NULL);
+ ufunc = find_func(funcref->fr_func_name, FALSE);
}
if (ufunc == NULL)
{
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)
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;
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,
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;
{
// 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);
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)
{
}
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);
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);
member_type = internal_func_ret_type(idx, 0, NULL);
}
else
- ufunc = find_func(name, FALSE, NULL);
+ ufunc = find_func(name, FALSE);
}
if (ufunc != NULL)
{