diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-26 20:46:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-26 20:46:08 +0200 |
commit | 97baee80f0906ee2f651ee1215ec033e84f866ad (patch) | |
tree | 7560f0e18fd45c54b9b2a7cc189c2e58d096e4b2 | |
parent | e99e84497b89e5f91df519790802770920ecf4fe (diff) | |
download | vim-git-97baee80f0906ee2f651ee1215ec033e84f866ad.tar.gz |
patch 7.4.2104v7.4.2104
Problem: Code duplication when unreferencing a function.
Solution: De-duplicate.
-rw-r--r-- | src/userfunc.c | 25 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 32bcceece..30eeb347f 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -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); } } diff --git a/src/version.c b/src/version.c index 8902c9f3a..171aa9cca 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2104, +/**/ 2103, /**/ 2102, |