diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-02-16 15:49:54 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-02-16 20:33:33 -0500 |
commit | 4166dd54ebb56083bf61f8d2d4b151c0e476e22c (patch) | |
tree | 919560c1649f9c35f1e8de59ed1278c332deeaa2 /server/util/btreemap.h | |
parent | 8ce804c66b2a6f24662d1568976c430777be2cd0 (diff) | |
download | sssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.tar.gz sssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.tar.xz sssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.zip |
Enhancements and bugfixes to util/btreemap.c 1) Remove useless and unused btreemap_new() 2) Fix potentially serious memory allocation error. btreemap now requires a TALLOC_CTX to be passed in for assignment to the top node of the tree. Previously it was creating a new root TALLOC_CTX 3) Add new function btreemap_get_keys that will return a sorted array (newly allocated using talloc_realloc()) of keys (const void *) 4) Change the btreemap to use (const void *) keys instead of (void *)
Diffstat (limited to 'server/util/btreemap.h')
-rw-r--r-- | server/util/btreemap.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/util/btreemap.h b/server/util/btreemap.h index 941e36e5b..c5c415075 100644 --- a/server/util/btreemap.h +++ b/server/util/btreemap.h @@ -28,12 +28,14 @@ enum { BTREEMAP_CREATE_RIGHT }; -typedef int (*btreemap_comparison_fn)(void *first, void *second); +typedef int (*btreemap_comparison_fn)(const void *first, const void *second); struct btreemap; -int btreemap_search_key(struct btreemap *map, void *key, struct btreemap **node); -void *btreemap_get_value(struct btreemap *map, void *key); -int btreemap_set_value(struct btreemap **map, void *key, void *value, +int btreemap_search_key(struct btreemap *map, const void *key, struct btreemap **node); +void *btreemap_get_value(struct btreemap *map, const void *key); +int btreemap_set_value(TALLOC_CTX *mem_ctx, + struct btreemap **map, const void *key, void *value, btreemap_comparison_fn comparator); +void btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map, const void ***array, int *count); #endif /*BTREEMAP_H_*/ |