]> granicus.if.org Git - vim/commitdiff
patch 7.4.2104 v7.4.2104
authorBram Moolenaar <Bram@vim.org>
Tue, 26 Jul 2016 18:46:08 +0000 (20:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 26 Jul 2016 18:46:08 +0000 (20:46 +0200)
Problem:    Code duplication when unreferencing a function.
Solution:   De-duplicate.

src/userfunc.c
src/version.c

index 32bcceece2c515b932b5ad87f799dbcedff2d988..30eeb347fbc6f1be645818c5982b8be078feb338 100644 (file)
@@ -2640,11 +2640,11 @@ ex_delfunction(exarg_T *eap)
     void
 func_unref(char_u *name)
 {
-    ufunc_T *fp;
+    ufunc_T *fp = NULL;
 
     if (name == NULL)
        return;
-    else if (isdigit(*name))
+    if (isdigit(*name))
     {
        fp = find_func(name);
        if (fp == NULL)
@@ -2654,25 +2654,18 @@ func_unref(char_u *name)
 #endif
                EMSG2(_(e_intern2), "func_unref()");
        }
-       else if (--fp->uf_refcount <= 0)
-       {
-           /* Only delete it when it's not being used.  Otherwise it's done
-            * when "uf_calls" becomes zero. */
-           if (fp->uf_calls == 0)
-               func_free(fp);
-       }
     }
     else if (STRNCMP(name, "<lambda>", 8) == 0)
     {
        /* fail silently, when lambda function isn't found. */
        fp = find_func(name);
-       if (fp != NULL && --fp->uf_refcount <= 0)
-       {
-           /* Only delete it when it's not being used.  Otherwise it's done
-            * when "uf_calls" becomes zero. */
-           if (fp->uf_calls == 0)
-               func_free(fp);
-       }
+    }
+    if (fp != NULL && --fp->uf_refcount <= 0)
+    {
+       /* Only delete it when it's not being used.  Otherwise it's done
+        * when "uf_calls" becomes zero. */
+       if (fp->uf_calls == 0)
+           func_free(fp);
     }
 }
 
index 8902c9f3a7b30a132fa6e9d40f0cc661e89c5af2..171aa9cca9116b82a87dfd546311a1fa9465803f 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2104,
 /**/
     2103,
 /**/