vim-patch:7.4.1068

Problem:    Wrong way to check for unletting internal variables.
Solution:   Use a better way. (Olaf Dabrunz)

71bcfdf301
This commit is contained in:
Michael Ennen 2016-05-20 23:17:41 -07:00
parent 326ae7c8ce
commit 1e6fa9338e
2 changed files with 18 additions and 11 deletions

View File

@ -2973,23 +2973,30 @@ int do_unlet(char_u *name, int forceit)
ht = find_var_ht_dict(name, &varname, &dict);
if (ht != NULL && *varname != NUL) {
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;
}
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)) {
|| var_check_ro(di->di_flags, name, false)
|| tv_check_lock(d->dv_lock, 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 {
di = find_var_in_ht(ht, *name, (char_u *)"", false);
d = di->di_tv.vval.v_dict;
}
if (d == NULL || tv_check_lock(d->dv_lock, name, false)) {
return FAIL;
}

View File

@ -625,7 +625,7 @@ static int included_patches[] = {
1071,
// 1070 NA
// 1069 NA
// 1068,
1068,
// 1067 NA
// 1066 NA
1065,