Skip to content

Commit 97baee8

Browse files
committed
patch 7.4.2104
Problem: Code duplication when unreferencing a function. Solution: De-duplicate.
1 parent e99e844 commit 97baee8

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

src/userfunc.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,11 +2640,11 @@ ex_delfunction(exarg_T *eap)
26402640
void
26412641
func_unref(char_u *name)
26422642
{
2643-
ufunc_T *fp;
2643+
ufunc_T *fp = NULL;
26442644

26452645
if (name == NULL)
26462646
return;
2647-
else if (isdigit(*name))
2647+
if (isdigit(*name))
26482648
{
26492649
fp = find_func(name);
26502650
if (fp == NULL)
@@ -2654,25 +2654,18 @@ func_unref(char_u *name)
26542654
#endif
26552655
EMSG2(_(e_intern2), "func_unref()");
26562656
}
2657-
else if (--fp->uf_refcount <= 0)
2658-
{
2659-
/* Only delete it when it's not being used. Otherwise it's done
2660-
* when "uf_calls" becomes zero. */
2661-
if (fp->uf_calls == 0)
2662-
func_free(fp);
2663-
}
26642657
}
26652658
else if (STRNCMP(name, "<lambda>", 8) == 0)
26662659
{
26672660
/* fail silently, when lambda function isn't found. */
26682661
fp = find_func(name);
2669-
if (fp != NULL && --fp->uf_refcount <= 0)
2670-
{
2671-
/* Only delete it when it's not being used. Otherwise it's done
2672-
* when "uf_calls" becomes zero. */
2673-
if (fp->uf_calls == 0)
2674-
func_free(fp);
2675-
}
2662+
}
2663+
if (fp != NULL && --fp->uf_refcount <= 0)
2664+
{
2665+
/* Only delete it when it's not being used. Otherwise it's done
2666+
* when "uf_calls" becomes zero. */
2667+
if (fp->uf_calls == 0)
2668+
func_free(fp);
26762669
}
26772670
}
26782671

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2104,
761763
/**/
762764
2103,
763765
/**/

0 commit comments

Comments
 (0)