mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 9.0.0990: callback name argument is changed by setqflist()
Problem: Callback name argument is changed by setqflist(). Solution: Use the expanded function name for the callback, do not store it in the argument. (closes #11653)
This commit is contained in:
@@ -4792,9 +4792,9 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
|
||||
/*
|
||||
* Get a callback from "arg". It can be a Funcref or a function name.
|
||||
* When "arg" is zero return an empty string.
|
||||
* "cb_name" is not allocated.
|
||||
* "cb_name" is set to NULL for an invalid argument.
|
||||
* When "arg" is zero "res.cb_name" is set to an empty string.
|
||||
* If "res.cb_name" is allocated then "res.cb_free_name" is set to TRUE.
|
||||
* "res.cb_name" is set to NULL for an invalid argument.
|
||||
*/
|
||||
callback_T
|
||||
get_callback(typval_T *arg)
|
||||
@@ -4802,7 +4802,7 @@ get_callback(typval_T *arg)
|
||||
callback_T res;
|
||||
int r = OK;
|
||||
|
||||
res.cb_free_name = FALSE;
|
||||
CLEAR_FIELD(res);
|
||||
if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
|
||||
{
|
||||
res.cb_partial = arg->vval.v_partial;
|
||||
@@ -4811,25 +4811,21 @@ get_callback(typval_T *arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
res.cb_partial = NULL;
|
||||
if (arg->v_type == VAR_STRING && arg->vval.v_string != NULL
|
||||
&& isdigit(*arg->vval.v_string))
|
||||
r = FAIL;
|
||||
else if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
|
||||
{
|
||||
res.cb_name = arg->vval.v_string;
|
||||
if (arg->v_type == VAR_STRING)
|
||||
{
|
||||
char_u *name;
|
||||
|
||||
name = get_scriptlocal_funcname(arg->vval.v_string);
|
||||
char_u *name = get_scriptlocal_funcname(arg->vval.v_string);
|
||||
if (name != NULL)
|
||||
{
|
||||
vim_free(arg->vval.v_string);
|
||||
arg->vval.v_string = name;
|
||||
res.cb_name = name;
|
||||
res.cb_free_name = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
res.cb_name = arg->vval.v_string;
|
||||
func_ref(res.cb_name);
|
||||
}
|
||||
else if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
|
||||
|
Reference in New Issue
Block a user