frontend/define.c, cleanup `prtree1()'

This commit is contained in:
rlar 2015-11-12 17:57:40 +01:00
parent 83938330eb
commit 045de93d3b
1 changed files with 6 additions and 10 deletions

View File

@ -261,11 +261,10 @@ prtree1(struct pnode *pn, FILE *fp)
struct pnode *
ft_substdef(const char *name, struct pnode *args)
{
struct udfunc *udf;
struct udfunc *udf, *wrong_udf = NULL;
struct pnode *tp;
char *s;
int arity = 0, rarity = 0;
bool found = FALSE;
int arity = 0;
if (args)
arity = 1;
@ -276,19 +275,16 @@ ft_substdef(const char *name, struct pnode *args)
for (udf = udfuncs; udf; udf = udf->ud_next)
if (eq(name, udf->ud_name)) {
if (arity == udf->ud_arity) {
if (arity == udf->ud_arity)
break;
} else {
found = TRUE;
rarity = udf->ud_arity;
}
wrong_udf = udf;
}
if (udf == NULL) {
if (found)
if (wrong_udf)
fprintf(cp_err,
"Warning: the user-defined function %s has %d args\n",
name, rarity);
name, wrong_udf->ud_arity);
return NULL;
}