summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-10-24 17:18:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-10-24 17:18:00 -0700
commit88ad8140418043da590f5e79c2599b19683c843b (patch)
tree167dd6b9d267b47906bb736683f07c88258d0b8f /parser.c
parentde53a2eaa1832388204a969fb79d11eb5f4a0790 (diff)
downloadtxr-88ad8140418043da590f5e79c2599b19683c843b.tar.gz
txr-88ad8140418043da590f5e79c2599b19683c843b.tar.bz2
txr-88ad8140418043da590f5e79c2599b19683c843b.zip
circle notation: recycle conses in backpatching.
* parser.c (circ_backpatch): Recycle the conses belonging to the temporary linked list allocated during hash table and tree backpatching.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index a849e980..292040fb 100644
--- a/parser.c
+++ b/parser.c
@@ -387,9 +387,12 @@ tail:
clearhash(obj);
while (pairs) {
- val cell = pop(&pairs);
+ val cell = rcyc_pop(&pairs);
sethash(obj, us_car(cell), us_cdr(cell));
}
+ } else {
+ while (pairs)
+ rcyc_pop(&pairs);
}
}
} else if (structp(obj)) {
@@ -427,9 +430,12 @@ tail:
tree_clear(obj);
while (nodes) {
- val node = pop(&nodes);
+ val node = rcyc_pop(&nodes);
tree_insert_node(obj, node);
}
+ } else {
+ while (nodes)
+ rcyc_pop(&nodes);
}
}