diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-08-05 21:46:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-08-05 21:46:08 -0700 |
commit | 2e0acd6057bd65b0b872356c51c1b7b1a06c89b9 (patch) | |
tree | a4483a81092a80fda41c624165586371d32a4dce /lib.h | |
parent | 2844bb73b485450660d70de2de489590d0995d9e (diff) | |
download | txr-2e0acd6057bd65b0b872356c51c1b7b1a06c89b9.tar.gz txr-2e0acd6057bd65b0b872356c51c1b7b1a06c89b9.tar.bz2 txr-2e0acd6057bd65b0b872356c51c1b7b1a06c89b9.zip |
bugfix: n-ary arith functions must check single arg.
We are allowing calls like (* "a") and (+ "a")
without diagnosing that the argument isn't of a valid
type. Note that (max "a") is fine beacause min and
max use the less function; they are not strictly numeric.
* lib.c (nary_op): Beef up function with additional argument
for type checking the unary case.
(unary_num, unary_arith, unary_int): New static functions.
(plusv, mulv, logandv, logiorv): Use new nary_op interface.
(gtv, ltv, gev, lev, numeqv, numneq): Check the
first number.
* lib.c (nary_op): Declaration updated.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -654,7 +654,9 @@ val bignump(val num); val floatp(val num); val integerp(val num); val numberp(val num); -val nary_op(val (*cfunc)(val, val), struct args *args, val emptyval); +val nary_op(val self, val (*bfun)(val, val), + val (*ufun)(val self, val), + struct args *args, val emptyval); val plus(val anum, val bnum); val plusv(struct args *); val minus(val anum, val bnum); |