Browse Source

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

pre-master-46
rlar 11 years ago
parent
commit
045de93d3b
  1. 16
      src/frontend/define.c

16
src/frontend/define.c

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

Loading…
Cancel
Save