summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-24 22:43:52 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-11-24 22:43:52 -0800
commite1841e6982a68ec90fc7c80901a98a66f21318b3 (patch)
tree6b87c3b3c8702c0e8dbb10c7dc6b14f2a997fc21 /match.c
parentabdf06ed559fbc2f775271027f5000202bac9ff3 (diff)
downloadtxr-e1841e6982a68ec90fc7c80901a98a66f21318b3.tar.gz
txr-e1841e6982a68ec90fc7c80901a98a66f21318b3.tar.bz2
txr-e1841e6982a68ec90fc7c80901a98a66f21318b3.zip
* lib.c (getplist_f): New function.
* lib.h (getplist_f): Declared. * match.c (v_collect, h_coll): Use getplist_f to distinguish the case that :vars is explicitly specified as (). In this case, no bindings escape from the collect. * tests/008/soundex.txr: This test case broke due to using :vars () and yet counting on the variable to exist. * RELNOTES: Updated.
Diffstat (limited to 'match.c')
-rw-r--r--match.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/match.c b/match.c
index dce83a45..7f34efc9 100644
--- a/match.c
+++ b/match.c
@@ -2261,7 +2261,8 @@ static val v_collect(match_files_ctx *c)
val mintimes = getplist(args, mintimes_k);
val maxtimes = getplist(args, maxtimes_k);
val lines = getplist(args, lines_k);
- val vars = getplist(args, vars_k);
+ val have_vars;
+ val vars = getplist_f(args, vars_k, &have_vars);
cnum cmax = nump(gap) ? c_num(gap) : (nump(max) ? c_num(max) : 0);
cnum cmin = nump(gap) ? c_num(gap) : (nump(min) ? c_num(min) : 0);
cnum mincounter = cmin, maxcounter = 0;
@@ -2356,7 +2357,7 @@ static val v_collect(match_files_ctx *c)
val binding = car(iter);
val vars_binding = assoc(vars, car(binding));
- if (!vars || vars_binding) {
+ if (!have_vars || vars_binding) {
val existing = assoc(bindings_coll, car(binding));
bindings_coll = acons_new(bindings_coll, car(binding),