summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-02 12:19:29 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-02 12:20:10 -0700
commit024f101e97197d1001cb9dd3403eee4a2e4c35bf (patch)
treed43e499646c9055042e1cd2a1531591d5f42d2b7 /match.c
parentb6f162c99e664b0deeb78b0c1c18eee3b0015267 (diff)
downloadtxr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.tar.gz
txr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.tar.bz2
txr-024f101e97197d1001cb9dd3403eee4a2e4c35bf.zip
Compiles as C++ again.
* lib.h (cons_set): New macro. * match.c (match_line, match_files): In collect clause handlers, move variable declarations above goto, and initialize with cons_set, instead of declaring and initializing with cons_bind. This eliminates the stupid C++ error that goto skips a variable initialization (which happens even when it can be trivially proven that the has no next use at the goto site!)
Diffstat (limited to 'match.c')
-rw-r--r--match.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/match.c b/match.c
index af259cf2..673ca9e2 100644
--- a/match.c
+++ b/match.c
@@ -495,6 +495,8 @@ static val match_line(val bindings, val specline, val dataline,
break;
for (;;) {
+ val new_bindings = nil, new_pos = nil;
+
if ((gap || min) && mincounter < cmin)
goto next_coll;
@@ -502,9 +504,9 @@ static val match_line(val bindings, val specline, val dataline,
break;
{
- cons_bind (new_bindings, new_pos,
- match_line(bindings, coll_specline, dataline, pos,
- spec_lineno, data_lineno, file));
+ cons_set (new_bindings, new_pos,
+ match_line(bindings, coll_specline, dataline, pos,
+ spec_lineno, data_lineno, file));
if (until_specline) {
cons_bind (until_bindings, until_pos,
@@ -1499,6 +1501,8 @@ repeat_spec_same_data:
result = t;
while (data) {
+ val new_bindings = nil, success = nil;
+
if ((gap || min) && mincounter < cmin)
goto next_collect;
@@ -1506,9 +1510,9 @@ repeat_spec_same_data:
break;
{
- cons_bind (new_bindings, success,
- match_files(coll_spec, files, bindings,
- data, num(data_lineno)));
+ cons_set (new_bindings, success,
+ match_files(coll_spec, files, bindings,
+ data, num(data_lineno)));
/* Until clause sees un-collated bindings from collect. */
if (until_spec)