Patch 7.4.2104
Problem:    Code duplication when unreferencing a function.
Solution:   De-duplicate.
Files:      src/userfunc.c


*** ../vim-7.4.2103/src/userfunc.c      2016-07-23 15:47:29.042684295 +0200
--- src/userfunc.c      2016-07-23 22:21:11.227769546 +0200
***************
*** 2640,2650 ****
      void
  func_unref(char_u *name)
  {
!     ufunc_T *fp;
  
      if (name == NULL)
        return;
!     else if (isdigit(*name))
      {
        fp = find_func(name);
        if (fp == NULL)
--- 2640,2650 ----
      void
  func_unref(char_u *name)
  {
!     ufunc_T *fp = NULL;
  
      if (name == NULL)
        return;
!     if (isdigit(*name))
      {
        fp = find_func(name);
        if (fp == NULL)
***************
*** 2654,2678 ****
  #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);
!       }
      }
  }
  
--- 2654,2671 ----
  #endif
                EMSG2(_(e_intern2), "func_unref()");
        }
      }
      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);
      }
  }
  
*** ../vim-7.4.2103/src/version.c       2016-07-26 20:43:37.020311769 +0200
--- src/version.c       2016-07-26 20:45:30.535272277 +0200
***************
*** 760,761 ****
--- 760,763 ----
  {   /* Add new patch number below this line */
+ /**/
+     2104,
  /**/

-- 
An indication you must be a manager:
You give constructive feedback to your dog.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui