From 11e02bb6ae1937698e67e7cdb5016bb4cfe17d51 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 8 Mar 2017 20:14:28 -0800 Subject: clean up open_data_source function. * match.c (open_data_source): do the spec_bind in just one place. Use first_spec consistently in the debuglf calls. --- match.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/match.c b/match.c index f183c509..d67f968b 100644 --- a/match.c +++ b/match.c @@ -4381,6 +4381,8 @@ static val h_assert(match_line_ctx *c) static void open_data_source(match_files_ctx *c) { + spec_bind (specline, first_spec, c->spec); + /* c->data == t is set up by the top level call to match_files. * It indicates that we have not yet opened any data source. */ @@ -4392,8 +4394,6 @@ static void open_data_source(match_files_ctx *c) val nothrow = tnil(ss_consp && car(source_spec) == nothrow_k); if (stringp(name)) { - spec_bind (specline, first_spec, c->spec); - if (consp(first_spec) && (gethash(non_matching_directive_table, first(first_spec))) && !rest(specline)) @@ -4403,13 +4403,12 @@ static void open_data_source(match_files_ctx *c) "directive."), name, nao); } else { val stream = complex_open(name, nil, nil, nothrow, t); - val spec = first(c->spec); - debuglf(spec, lit("opening data source ~a"), name, nao); + debuglf(specline, lit("opening data source ~a"), name, nao); if (!stream) { - debuglf(spec, lit("could not open ~a: " - "treating as failed match due to nothrow"), name, nao); + debuglf(first_spec, lit("could not open ~a: " + "treating as failed match due to nothrow"), name, nao); c->data = nil; return; } @@ -4430,7 +4429,6 @@ static void open_data_source(match_files_ctx *c) if (opt_compat && opt_compat <= 170) { c->data = nil; } else { - spec_bind (specline, first_spec, c->spec); debuglf(first_spec, lit("opening standard input as data source"), nao); c->curfile = lit("-"); c->data = lazy_stream_cons(std_input); -- cgit v1.2.3