mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.2104
Problem: Code duplication when unreferencing a function.
Solution: De-duplicate.
97baee80f0
This commit is contained in:
parent
cbaa87a639
commit
6563d85990
@ -21960,11 +21960,12 @@ static void func_free(ufunc_T *fp)
|
|||||||
*/
|
*/
|
||||||
void func_unref(char_u *name)
|
void func_unref(char_u *name)
|
||||||
{
|
{
|
||||||
ufunc_T *fp;
|
ufunc_T *fp = NULL;
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return;
|
return;
|
||||||
} else if (isdigit(*name)) {
|
}
|
||||||
|
if (isdigit(*name)) {
|
||||||
fp = find_func(name);
|
fp = find_func(name);
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
#ifdef EXITFREE
|
#ifdef EXITFREE
|
||||||
@ -21980,12 +21981,12 @@ void func_unref(char_u *name)
|
|||||||
} else if (STRNCMP(name, "<lambda>", 8) == 0) {
|
} else if (STRNCMP(name, "<lambda>", 8) == 0) {
|
||||||
// fail silently, when lambda function isn't found
|
// fail silently, when lambda function isn't found
|
||||||
fp = find_func(name);
|
fp = find_func(name);
|
||||||
if (fp != NULL && --fp->uf_refcount <= 0) {
|
}
|
||||||
// Only delete it when it's not being used. Otherwise it's done
|
if (fp != NULL && --fp->uf_refcount <= 0) {
|
||||||
// when "uf_calls" becomes zero.
|
// Only delete it when it's not being used. Otherwise it's done
|
||||||
if (fp->uf_calls == 0) {
|
// when "uf_calls" becomes zero.
|
||||||
func_free(fp);
|
if (fp->uf_calls == 0) {
|
||||||
}
|
func_free(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user