From de2c2b47f9c0858f785cafc276104377a7357630 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 15 Jan 2016 19:38:21 -0800 Subject: Gather bugfix: support empty :vars. * match.c (v_gather): Use getplist_f to distinguish the :vars nil case just like v_collect does. A :vars nil gather could be useful; it says none of the variables are strictly required. In any case, it is not correct to treat :vars nil as if :vars weren't there. --- match.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/match.c b/match.c index 3c78e651..22bb3fb5 100644 --- a/match.c +++ b/match.c @@ -2596,7 +2596,10 @@ static val v_gather(match_files_ctx *c) val specs = copy_list(second(first_spec)); val args = third(first_spec); val until_last = fourth(first_spec); - val vars = vars_to_bindings(specline, getplist(args, vars_k), c->bindings); + val have_vars; + val vars = vars_to_bindings(specline, + getplist_f(args, vars_k, mkcloc(have_vars)), + c->bindings); while (specs && c->data) { list_collect_decl (new_specs, ptail); @@ -2669,7 +2672,7 @@ static val v_gather(match_files_ctx *c) } } - if (vars) { + if (have_vars) { val iter; for (iter = vars; iter != nil; iter = cdr(iter)) { -- cgit v1.2.3