diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-05-13 06:40:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-05-13 06:40:27 -0700 |
commit | e52a3af6e66ce2ac13a6fcdc006706a34f1411dc (patch) | |
tree | d606795cbf01034e18b2d9fed2a5a8ae8076e15c | |
parent | 1cf9f19e47f2ab757a6eedc1969c81bdb8e8a5f4 (diff) | |
download | txr-e52a3af6e66ce2ac13a6fcdc006706a34f1411dc.tar.gz txr-e52a3af6e66ce2ac13a6fcdc006706a34f1411dc.tar.bz2 txr-e52a3af6e66ce2ac13a6fcdc006706a34f1411dc.zip |
Bugfix in - and / functions.
Improper handling of arguments in certain cases.
Test case: [[flipargs -] 2 1]. Should yield -1;
actual behavior is error.
* lib.c (minusv, divv): Correct test for more
arguments after extracting the leftmost one.
-rw-r--r-- | lib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -2816,12 +2816,12 @@ val minusv(val minuend, struct args *nlist) cnum index = 0; val fi; - if (!args_more(nlist, 0)) + if (!args_more(nlist, index)) return neg(minuend); fi = args_get(nlist, &index); - if (!args_more(nlist, 0)) + if (!args_more(nlist, index)) return minus(minuend, fi); return reduce_left(func_n2(minus), args_get_list(nlist), @@ -2838,12 +2838,12 @@ val divv(val dividend, struct args *nlist) cnum index = 0; val fi; - if (!args_more(nlist, 0)) + if (!args_more(nlist, index)) return divi(one, dividend); fi = args_get(nlist, &index); - if (!args_more(nlist, 0)) + if (!args_more(nlist, index)) return divi(dividend, fi); return reduce_left(func_n2(divi), args_get_list(nlist), |