From 55fb752488f14ba69e2e644f96940a1cf4689a97 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 9 Feb 2020 07:54:26 -0800 Subject: 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. --- match.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'match.c') 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; -- cgit v1.2.3