diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gehashmap.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/gehashmap.c b/examples/gehashmap.c index 1ddd391..df91669 100644 --- a/examples/gehashmap.c +++ b/examples/gehashmap.c @@ -56,6 +56,7 @@ main(void) { int i; unsigned int u; + struct atoimap_entry *entry, *tmp; atoimap_t *map_a; itoumap_t *map_b; @@ -69,6 +70,11 @@ main(void) atoimap_get(map_a, "THOMAS VOẞ", &i); printf("THOMAS VOẞ -> %d\n", i); atoimap_get(map_a, "Thomas Voss", &i); printf("Thomas Voss -> %d\n", i); + GEHASHMAP_FOREACH_SAFE(entry, tmp, map_a) + atoimap_remove(map_a, entry->key); + GEHASHMAP_FOREACH(entry, map_a) + puts(entry->key); + itoumap_set(map_b, -42, +42); itoumap_set(map_b, -69, +69); itoumap_set(map_b, -420, +420); @@ -92,6 +98,16 @@ main(void) atoimap_free(map_a); itoumap_free(map_b); + atoimap_new(map_a); + atoimap_set(map_a, strdup("Thomas Voß"), 5); + atoimap_set(map_a, strdup("THOMAS VOẞ"), 6); + atoimap_set(map_a, strdup("Thomas Voss"), 7); + + GEHASHMAP_FOREACH(entry, map_a) + free(entry->key); + + atoimap_free(map_a); + free(map_a); free(map_b); } |