summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-02-09 07:54:26 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-09 07:54:26 -0800
commit69ae6dc4576ba967a4b86394e3cc067c3747e1e5 (patch)
tree0ce5c7f6404c95f9b31e7b2f304efb0e461418d8
parente04312c54b84f3acb738906cf8675159f4164ecc (diff)
downloadtxr-69ae6dc4576ba967a4b86394e3cc067c3747e1e5.tar.gz
txr-69ae6dc4576ba967a4b86394e3cc067c3747e1e5.tar.bz2
txr-69ae6dc4576ba967a4b86394e3cc067c3747e1e5.zip
bugfix: regression in @(skip).
When @(skip :greedy) is used, there is an exception complaining that :greedy isn't an integer. Reported by a user "natrys" in the IRC channel. This was introduced in July 2016, by commit 2d61ef2487adebed44037af704c0bcecc1761731, "Address silly uses of fixnump". * match.c (h_skip, v_skip): Re-introduce the integer check that was indadvertently removed.
-rw-r--r--match.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/match.c b/match.c
index 18b3fd20..30f26137 100644
--- a/match.c
+++ b/match.c
@@ -826,8 +826,8 @@ static val h_skip(match_line_ctx *c)
val elem = first(c->specline);
val max = tleval_144(elem, second(elem), c->bindings);
val min = tleval_144(elem, third(elem), c->bindings);
- cnum cmax = if3(max, c_num(max), 0);
- cnum cmin = if3(min, c_num(min), 0);
+ cnum cmax = integerp(max) ? c_num(max) : 0;
+ cnum cmin = integerp(min) ? c_num(min) : 0;
val greedy = eq(max, greedy_k);
val last_good_result = nil, last_good_pos = nil;
@@ -2333,8 +2333,8 @@ static val v_skip(match_files_ctx *c)
val args = rest(first_spec);
val max = tleval_144(skipspec, first(args), c->bindings);
val min = tleval_144(skipspec, second(args), c->bindings);
- cnum cmax = if3(max, c_num(max), 0);
- cnum cmin = if3(min, c_num(min), 0);
+ cnum cmax = integerp(max) ? c_num(max) : 0;
+ cnum cmin = integerp(min) ? c_num(min) : 0;
val greedy = eq(max, greedy_k);
volatile val last_good_result = nil;
volatile val last_good_line = zero;