0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.3.895

Problem:    Valgrind error in test 91. (Issue 128)
Solution:   Pass scope name to find_var_in_ht().
This commit is contained in:
Bram Moolenaar 2013-04-15 13:06:21 +02:00
parent 84b0493c34
commit 332ac0621c
2 changed files with 17 additions and 21 deletions

View File

@ -788,7 +788,7 @@ static char_u *get_tv_string __ARGS((typval_T *varp));
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf)); static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf)); static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp)); static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, char_u *varname, int writing)); static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, int htname, char_u *varname, int writing));
static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname)); static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val)); static void vars_clear_ext __ARGS((hashtab_T *ht, int free_val));
static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi)); static void delete_var __ARGS((hashtab_T *ht, hashitem_T *hi));
@ -11150,13 +11150,10 @@ f_getbufvar(argvars, rettv)
} }
else else
{ {
if (*varname == NUL) /* Look up the variable. */
/* let getbufvar({nr}, "") return the "b:" dictionary. The /* Let getbufvar({nr}, "") return the "b:" dictionary. */
* scope prefix before the NUL byte is required by v = find_var_in_ht(&curbuf->b_vars->dv_hashtab,
* find_var_in_ht(). */ 'b', varname, FALSE);
varname = (char_u *)"b:" + 2;
/* look up the variable */
v = find_var_in_ht(&curbuf->b_vars->dv_hashtab, varname, FALSE);
if (v != NULL) if (v != NULL)
copy_tv(&v->di_tv, rettv); copy_tv(&v->di_tv, rettv);
} }
@ -11779,7 +11776,7 @@ f_gettabvar(argvars, rettv)
if (tp != NULL && varname != NULL) if (tp != NULL && varname != NULL)
{ {
/* look up the variable */ /* look up the variable */
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, varname, FALSE); v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE);
if (v != NULL) if (v != NULL)
copy_tv(&v->di_tv, rettv); copy_tv(&v->di_tv, rettv);
else if (argvars[2].v_type != VAR_UNKNOWN) else if (argvars[2].v_type != VAR_UNKNOWN)
@ -11929,13 +11926,9 @@ getwinvar(argvars, rettv, off)
get_option_tv(&varname, rettv, 1); get_option_tv(&varname, rettv, 1);
else else
{ {
if (*varname == NUL) /* Look up the variable. */
/* let getwinvar({nr}, "") return the "w:" dictionary. The /* Let getwinvar({nr}, "") return the "w:" dictionary. */
* scope prefix before the NUL byte is required by v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE);
* find_var_in_ht(). */
varname = (char_u *)"w:" + 2;
/* look up the variable */
v = find_var_in_ht(&win->w_vars->dv_hashtab, varname, FALSE);
if (v != NULL) if (v != NULL)
copy_tv(&v->di_tv, rettv); copy_tv(&v->di_tv, rettv);
} }
@ -20041,16 +20034,17 @@ find_var(name, htp)
*htp = ht; *htp = ht;
if (ht == NULL) if (ht == NULL)
return NULL; return NULL;
return find_var_in_ht(ht, varname, htp != NULL); return find_var_in_ht(ht, *name, varname, htp != NULL);
} }
/* /*
* Find variable "varname" in hashtab "ht". * Find variable "varname" in hashtab "ht" with name "htname".
* Returns NULL if not found. * Returns NULL if not found.
*/ */
static dictitem_T * static dictitem_T *
find_var_in_ht(ht, varname, writing) find_var_in_ht(ht, htname, varname, writing)
hashtab_T *ht; hashtab_T *ht;
int htname;
char_u *varname; char_u *varname;
int writing; int writing;
{ {
@ -20059,7 +20053,7 @@ find_var_in_ht(ht, varname, writing)
if (*varname == NUL) if (*varname == NUL)
{ {
/* Must be something like "s:", otherwise "ht" would be NULL. */ /* Must be something like "s:", otherwise "ht" would be NULL. */
switch (varname[-2]) switch (htname)
{ {
case 's': return &SCRIPT_SV(current_SID)->sv_var; case 's': return &SCRIPT_SV(current_SID)->sv_var;
case 'g': return &globvars_var; case 'g': return &globvars_var;
@ -20389,7 +20383,7 @@ set_var(name, tv, copy)
EMSG2(_(e_illvar), name); EMSG2(_(e_illvar), name);
return; return;
} }
v = find_var_in_ht(ht, varname, TRUE); v = find_var_in_ht(ht, 0, varname, TRUE);
if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL)) if (tv->v_type == VAR_FUNC && var_check_func_name(name, v == NULL))
return; return;

View File

@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
895,
/**/ /**/
894, 894,
/**/ /**/