To: vim_dev@googlegroups.com Subject: Patch 7.4.2104 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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, "", 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, "", 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 -- Bram@Moolenaar.net -- 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 ///