summaryrefslogtreecommitdiffstats
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
commit41b9e4324df84869611c664ced877e2bc5d959ae (patch)
tree167dd6b9d267b47906bb736683f07c88258d0b8f
parent3238ecdcf6a76f55f3b7352a90bea1c0959a9f25 (diff)
downloadtxr-41b9e4324df84869611c664ced877e2bc5d959ae.tar.gz
txr-41b9e4324df84869611c664ced877e2bc5d959ae.tar.bz2
txr-41b9e4324df84869611c664ced877e2bc5d959ae.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.
-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);
}
}