mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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:
parent
326ae7c8ce
commit
1e6fa9338e
@ -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 == ¤t_funccal->l_vars.dv_hashtab) {
|
||||
d = ¤t_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 == ¤t_funccal->l_vars.dv_hashtab) {
|
||||
d = ¤t_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;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ static int included_patches[] = {
|
||||
1071,
|
||||
// 1070 NA
|
||||
// 1069 NA
|
||||
// 1068,
|
||||
1068,
|
||||
// 1067 NA
|
||||
// 1066 NA
|
||||
1065,
|
||||
|
Loading…
Reference in New Issue
Block a user