summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-03 21:05:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-03 21:05:23 -0700
commit02f21d78ee7e14f23fb5f708a08c7273f48eb6d5 (patch)
treec503280e37d50076431c51b6df1a65942b1c90a9
parent592bb72c0f738b0227a8986e66e43f5937fb4ff9 (diff)
downloadtxr-02f21d78ee7e14f23fb5f708a08c7273f48eb6d5.tar.gz
txr-02f21d78ee7e14f23fb5f708a08c7273f48eb6d5.tar.bz2
txr-02f21d78ee7e14f23fb5f708a08c7273f48eb6d5.zip
func-optparam-count: bugfix.
* lib.c (get_param_counts): If there are no optional parameters, then the oa variable stays negative; we must turn that into a zero, otherwise we return the bogus value -1 as the number of optional arguments.
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 89f01344..dcf9e870 100644
--- a/lib.c
+++ b/lib.c
@@ -7168,7 +7168,7 @@ static val get_param_counts(val params, cnum *fixparam, cnum *optparam)
}
*fixparam = fx;
- *optparam = oa;
+ *optparam = (oa > 0) ? oa : 0;
return params;
}