void cfgi_parse(struct cfgi_t *cih, char *filename, void *ctx) { cih->ctx = ctx; cfg_parser_parse(cih->parser, filename, (void*) cih); strmap_iterate(cih->types, cfgi_iterate_objects, cih); strmap_iterate(cih->types, cfgi_destroy_objects, NULL); cih->ctx = NULL; }
static void remove_undefined(struct cdump_map *map) { struct cdump_map undefs; /* We can't delete inside iterator, so gather all the undefs * then remove them. */ strmap_init(&undefs); strmap_iterate(map, gather_undefines, &undefs); strmap_iterate(&undefs, remove_from_map, map); strmap_clear(&undefs); }
void destroy_factoids() { factoid_file = fopen("factoids", "w"); if (factoid_file == NULL) return; strmap_iterate(&factoids, write_factoid); strmap_destroy(&factoids); fclose(factoid_file); }
int main(void) { STRMAP(char *) map; plan_tests(3); strmap_init(&map); ok1(strmap_add(&map, "hello", "hello")); ok1(strmap_add(&map, "world", "world")); strmap_iterate(&map, find_string, (const char *)"hello"); ok1(found); strmap_clear(&map); /* This exits depending on whether all tests passed */ return exit_status(); }
void rirtype_strmap_free(struct rirtype_strmap *map) { strmap_iterate(map, (strmap_it_cb)itfree_rirtypestring, NULL); strmap_clear(map); }
void rirobjmap_print(const struct rirobj_strmap *m) { strmap_iterate(m, (strmap_it_cb)rirobjmap_print_cb, NULL); }
void rirobjmap_free(struct rirobj_strmap *map, struct rir_common *c) { strmap_iterate(map, (strmap_it_cb)itfree_rirobjects, c); strmap_clear(map); }