summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-11-01 20:27:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-11-01 20:27:42 -0700
commit1a71176dca92298cbb4e93530be2a79c80956471 (patch)
tree67c9b7e0d943cf26f89776b58c3b5060ed48f073 /parser.c
parentfcd748480a76b3fef7586483b29fc5281e405e1f (diff)
downloadtxr-1a71176dca92298cbb4e93530be2a79c80956471.tar.gz
txr-1a71176dca92298cbb4e93530be2a79c80956471.tar.bz2
txr-1a71176dca92298cbb4e93530be2a79c80956471.zip
lib: use stack-allocated hash iterators everywhere.
* eval.c (op_dohash): Use hash_iter instead of consing up heap-allocated hash iterator. * filter.c (trie_compress, regex_from_trie): Likewise. * hash.c (hash_equal_op, hash_hash_op, hash_print_op): Likewise. * lib.c (package_local_symbols, package_foreign_symbols, find_max, find_if, rfind_if, populate_obj_hash): Likewise. * parser.c (circ_backpatch, get_visible_syms): Likewise. * struct.c (method_name, get_slot_syms): Likewise.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/parser.c b/parser.c
index c303f9e1..a0c51292 100644
--- a/parser.c
+++ b/parser.c
@@ -372,11 +372,13 @@ tail:
circ_backpatch(p, &cs, u);
if (old_circ_count > 0) {
- val iter = hash_begin(obj);
val cell;
val pairs = nil;
+ struct hash_iter hi;
- while ((cell = hash_next(iter))) {
+ us_hash_iter_init(&hi, obj);
+
+ while ((cell = hash_iter_next(&hi))) {
circ_backpatch(p, &cs, cell);
push(cell, &pairs);
}
@@ -836,10 +838,13 @@ static val get_visible_syms(val package, int include_fallback)
for (; fblist; fblist = cdr(fblist))
{
val fb_pkg = car(fblist);
- val hiter = hash_begin(fb_pkg->pk.symhash);
val fcell;
val new_p;
- while ((fcell = hash_next(hiter))) {
+ struct hash_iter hi;
+
+ us_hash_iter_init(&hi, fb_pkg->pk.symhash);
+
+ while ((fcell = hash_iter_next(&hi))) {
loc pcdr = gethash_l(lit("listener"), symhash, us_car(fcell), mkcloc(new_p));
if (new_p)
set(pcdr, us_cdr(fcell));