From 13fd2c5e21425e27411299081d5b4102f5855179 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 21 Jan 2012 10:29:24 +0100 Subject: Add public function bpt_for_mappings. --- bpt_test.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'bpt_test.c') diff --git a/bpt_test.c b/bpt_test.c index 9f57152..225baa0 100644 --- a/bpt_test.c +++ b/bpt_test.c @@ -6,13 +6,12 @@ void print_deallocation(bpt_key_t key, void *value) { printf("Deallocated: %s\n", value); } +void print_mapping(bpt_key_t key, void *value, void *user_data) { + printf(" %d -> %s\n", key, value); +} + void print_tree(bpt_t b) { - int i; - for (i = 0; i < 10; i++) { - if (bpt_has_key(b, i)) { - printf(" %d -> %s\n", i, bpt_get(b, i)); - } - } + bpt_for_mappings(b, print_mapping, NULL); } bpt_t bpt_assoc_and_release(bpt_t bpt, bpt_key_t key, void *value) { -- cgit v1.2.3