summaryrefslogtreecommitdiffstats
path: root/match.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 /match.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 'match.c')
-rw-r--r--match.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/match.c b/match.c
index 230b7be3..200a1fea 100644
--- a/match.c
+++ b/match.c
@@ -221,12 +221,12 @@ static val weird_merge(val left, val right)
val left_depth = depth(left);
val right_depth = depth(right);
- while (lt(left_depth, right_depth) || zerop(left_depth)) {
+ while (!plusp(left_depth)) {
left = cons(left, nil);
left_depth = plus(left_depth, one);
}
- while (lt(right_depth, left_depth) || zerop(right_depth)) {
+ while (!plusp(right_depth)) {
right = cons(right, nil);
right_depth = plus(right_depth, one);
}