]> granicus.if.org Git - vim/commitdiff
patch 7.4.1068 v7.4.1068
authorBram Moolenaar <Bram@vim.org>
Sat, 9 Jan 2016 17:20:46 +0000 (18:20 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Jan 2016 17:20:46 +0000 (18:20 +0100)
Problem:    Wrong way to check for unletting internal variables.
Solution:   Use a better way. (Olaf Dabrunz)

src/eval.c
src/version.c

index 89407b2977bba5f6665b9692df53a4adffeadcae..dd19492286b24fe86ce1d1d908d9de51147e24e7 100644 (file)
@@ -3738,25 +3738,30 @@ do_unlet(name, forceit)
     ht = find_var_ht(name, &varname);
     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 == NULL ? NULL : 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))
-               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))
+                   || var_check_ro(di->di_flags, name, FALSE)
+                   || tv_check_lock(d->dv_lock, name, FALSE))
                return FAIL;
 
            delete_var(ht, hi);
index 68972921f204d4e9a83b965ce24557fdf270e5e5..4bc3963c2c68f78ec06a6f5254c01d502502ea9e 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1068,
 /**/
     1067,
 /**/