diff options
author | Marvin Borner | 2023-06-01 16:14:34 +0200 |
---|---|---|
committer | Marvin Borner | 2023-06-01 16:56:39 +0200 |
commit | ccd4914d395b5a588868cffaad580c29167e6747 (patch) | |
tree | fd24dbb444745736ed07991a23e1305217a012f2 /src/map.c | |
parent | 931df5e774eebb098c5d7be93937d2b2f12b86ac (diff) |
More parenting
Diffstat (limited to 'src/map.c')
-rw-r--r-- | src/map.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -28,9 +28,9 @@ struct term *map_get(struct hashmap *map, hash_t hash) return *handle; } -void map_set(struct hashmap *map, struct term *term, hash_t hash) +void map_set(struct hashmap *map, struct term *term) { - hashmap_set(map, &term, hash); + hashmap_set(map, &term, term->hash); } void map_initialize(void) @@ -55,9 +55,18 @@ void map_dump(struct hashmap *map) void *iter_val; while (hashmap_iter(map, &iter, &iter_val)) { struct term *term = *(struct term **)iter_val; - fprintf(stderr, "%d ", term->type); + fprintf(stderr, "%d\t%ld\t", term->type, term->refs); term_print(term); - fprintf(stderr, " %ld\n", term->refs); + fprintf(stderr, "\t{"); + + size_t jiter = 0; + void *jiter_val; + while (hashmap_iter(term->parents, &jiter, &jiter_val)) { + struct term *parent = *(struct term **)jiter_val; + term_print(parent); + fprintf(stderr, ", "); + } + fprintf(stderr, "}\n"); } fprintf(stderr, "---\n\n"); } |