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

patch 7.4.1068

Problem:    Wrong way to check for unletting internal variables.
Solution:   Use a better way. (Olaf Dabrunz)
This commit is contained in:
Bram Moolenaar
2016-01-09 18:20:46 +01:00
parent 449538c3d2
commit 71bcfdf301
2 changed files with 21 additions and 14 deletions

View File

@@ -3738,25 +3738,30 @@ do_unlet(name, forceit)
ht = find_var_ht(name, &varname);
if (ht != NULL && *varname != NUL)
{
hi = hash_find(ht, varname);
if (!HASHITEM_EMPTY(hi))
{
di = HI2DI(hi);
if (var_check_fixed(di->di_flags, name, FALSE)
|| var_check_ro(di->di_flags, name, FALSE))
return FAIL;
if (ht == &globvarht)
d = &globvardict;
else if (current_funccal != NULL
&& ht == &current_funccal->l_vars.dv_hashtab)
d = &current_funccal->l_vars;
else if (ht == &compat_hashtab)
d = &vimvardict;
else
{
di = find_var_in_ht(ht, *name, (char_u *)"", FALSE);
d = di->di_tv.vval.v_dict;
d = di == NULL ? NULL : di->di_tv.vval.v_dict;
}
if (d == NULL || tv_check_lock(d->dv_lock, name, FALSE))
if (d == NULL)
{
EMSG2(_(e_intern2), "do_unlet()");
return FAIL;
}
hi = hash_find(ht, varname);
if (!HASHITEM_EMPTY(hi))
{
di = HI2DI(hi);
if (var_check_fixed(di->di_flags, name, FALSE)
|| var_check_ro(di->di_flags, name, FALSE)
|| tv_check_lock(d->dv_lock, name, FALSE))
return FAIL;
delete_var(ht, hi);

View File

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