summaryrefslogtreecommitdiffstats
path: root/combi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-06-15 00:27:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-06-15 00:27:50 -0700
commit3f87793404053b98fe0f6a20fafaf7e841f23f71 (patch)
treed7262e22b49b76c1ab7131af1087db96814be6f3 /combi.c
parent2f2126e0e8b67b63c08ad2d86e07f076233bb2bb (diff)
downloadtxr-3f87793404053b98fe0f6a20fafaf7e841f23f71.tar.gz
txr-3f87793404053b98fe0f6a20fafaf7e841f23f71.tar.bz2
txr-3f87793404053b98fe0f6a20fafaf7e841f23f71.zip
Replace lt(x, zero) pattern.
This slight inefficiency occurs in some 37 places in the code. In most places we replace lt(x, zero) with minusp(x). In a few places, !plusp(x) is used and surrounding logic is simplified. In one case, the silly pattern lt(x, zero) ? t : nil is replaced with just minusp(x). * buf.c (sub_buf, replace_buf): Replace lt. * combi.c (perm, rperm, comb, rcomb): Likewise. * eval.c (do_format_field): Likewise. * lib.c (listref, sub_list, replace_list, split_func, split_star_func, match_str, lazy_sub-str, sub_str, replace_str, sub_vec, replace_vec): Likewise. * match.c (weird_merge): Likewise. * regex.c (match_regex, match_regex_right_old, match_regex_right, regex_prefix_match, regex_range_left, regex_range_right): Likewise.
Diffstat (limited to 'combi.c')
-rw-r--r--combi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/combi.c b/combi.c
index f2cd8159..e63cfffb 100644
--- a/combi.c
+++ b/combi.c
@@ -213,7 +213,7 @@ val perm(val seq, val k)
if (!integerp(k))
type_mismatch(lit("perm: ~s is not an integer"), k, nao);
- if (lt(k, zero))
+ if (minusp(k))
uw_throwf(numeric_error_s, lit("perm: ~s is not a positive integer"),
k, nao);
}
@@ -304,7 +304,7 @@ val rperm(val seq, val k)
if (!integerp(k))
type_mismatch(lit("rperm: ~s is not an integer"), k, nao);
- if (lt(k, zero))
+ if (minusp(k))
uw_throwf(numeric_error_s, lit("rperm: ~s is not a positive integer"),
k, nao);
@@ -463,7 +463,7 @@ val comb(val seq, val k)
if (!integerp(k))
type_mismatch(lit("comb: ~s is not an integer"), k, nao);
- if (lt(k, zero))
+ if (minusp(k))
uw_throwf(numeric_error_s, lit("comb: ~s is not a positive integer"),
k, nao);
@@ -593,7 +593,7 @@ val rcomb(val seq, val k)
if (!integerp(k))
type_mismatch(lit("rcomb: ~s is not an integer"), k, nao);
- if (lt(k, zero))
+ if (minusp(k))
uw_throwf(numeric_error_s, lit("rcomb: ~s is not a positive integer"),
k, nao);