diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-11-01 20:27:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-11-01 20:27:42 -0700 |
commit | 1a71176dca92298cbb4e93530be2a79c80956471 (patch) | |
tree | 67c9b7e0d943cf26f89776b58c3b5060ed48f073 /struct.c | |
parent | fcd748480a76b3fef7586483b29fc5281e405e1f (diff) | |
download | txr-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 'struct.c')
-rw-r--r-- | struct.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1649,10 +1649,12 @@ static val struct_inst_equalsub(val obj) val method_name(val fun) { - val sth_iter = hash_begin(struct_type_hash); + struct hash_iter sthi; val sth_cell; - while ((sth_cell = hash_next(sth_iter))) { + us_hash_iter_init(&sthi, struct_type_hash); + + while ((sth_cell = hash_iter_next(&sthi))) { val sym = us_car(sth_cell); val stype = us_cdr(sth_cell); val sl_iter; @@ -1695,10 +1697,12 @@ val method_name(val fun) val get_slot_syms(val package, val is_current, val method_only) { val result_hash = make_hash(nil, nil, nil); - val sth_iter = hash_begin(struct_type_hash); + struct hash_iter sthi; val sth_cell; - while ((sth_cell = hash_next(sth_iter))) { + us_hash_iter_init(&sthi, struct_type_hash); + + while ((sth_cell = hash_iter_next(&sthi))) { val stype = us_cdr(sth_cell); val sl_iter; struct struct_type *st = coerce(struct struct_type *, stype->co.handle); |