summaryrefslogtreecommitdiffstats
path: root/match.c
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:57:09 -0800
commit55fb752488f14ba69e2e644f96940a1cf4689a97 (patch)
tree0ce5c7f6404c95f9b31e7b2f304efb0e461418d8 /match.c
parent86f914e7aa7214d049356d17bd8ad85a28eb32ce (diff)
downloadtxr-55fb752488f14ba69e2e644f96940a1cf4689a97.tar.gz
txr-55fb752488f14ba69e2e644f96940a1cf4689a97.tar.bz2
txr-55fb752488f14ba69e2e644f96940a1cf4689a97.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 a208fafe0b0bf6dd5a78c939e55f0153f6bd6b19, "Address silly uses of fixnump". * match.c (h_skip, v_skip): Re-introduce the integer check that was indadvertently removed.
Diffstat (limited to 'match.c')
-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;