summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-05 23:48:58 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-03-05 23:48:58 -0800
commit70f84f0b4d463049ee3be0e37c254d5a7cf931ac (patch)
treeef42e849768d8c26e599d508ce13a5bdb52b20b9 /match.c
parentb6b7464882986fc24d7e3e6f37b694593d1097a1 (diff)
downloadtxr-70f84f0b4d463049ee3be0e37c254d5a7cf931ac.tar.gz
txr-70f84f0b4d463049ee3be0e37c254d5a7cf931ac.tar.bz2
txr-70f84f0b4d463049ee3be0e37c254d5a7cf931ac.zip
Fixing regression caused by the 2014-02-19 change ("Fixed long-running
issue ..."). * match.c (open_data_source): if c->data is t, but c->files is nil, set c->data to nil: we cannot possibly open anything later. (match_files): We need to call open_data_source one more time just before processing a line with horizontal material. The previous call(s) to open_data_source might not have opened anything. Before accesing car(c.data) the correct test is consp(c.data), not c.data. In the else clause, we now specificially check for nilp(c.data) which is the correct indicator of no more data. If c.data is any other atom at that point, we have an internal error, for which an assertion is added now.
Diffstat (limited to 'match.c')
-rw-r--r--match.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/match.c b/match.c
index dd9cbc42..bd2666e4 100644
--- a/match.c
+++ b/match.c
@@ -3699,6 +3699,8 @@ static void open_data_source(match_files_ctx *c)
} else {
c->data = nil;
}
+ } else if (c->data == t && c->files == nil) {
+ c->data = nil;
}
}
@@ -3753,7 +3755,9 @@ repeat_spec_same_data:
}
}
- if (c.data && car(c.data))
+ open_data_source(&c);
+
+ if (consp(c.data) && car(c.data))
{
val dataline = car(c.data);
@@ -3766,9 +3770,11 @@ repeat_spec_same_data:
debug_return (nil);
c.bindings = new_bindings;
- } else {
+ } else if (nilp(c.data)) {
debuglf(specline, lit("spec ran out of data"), nao);
debug_return (nil);
+ } else {
+ internal_error("bug in data stream opening logic");
}
}