diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 16:42:47 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 16:42:47 +1030 |
commit | 0ac7deefbf190e11d38cc47807e0f5f6cfb1775e (patch) | |
tree | eb45e5db11b9d051b117e63a2cd4f4d69e7e9c19 /lib/ccan/htable/test/run-size.c | |
parent | 19409ddaf2414dd1d8ef183c834b37c8767034b0 (diff) | |
download | samba-0ac7deefbf190e11d38cc47807e0f5f6cfb1775e.tar.gz samba-0ac7deefbf190e11d38cc47807e0f5f6cfb1775e.tar.bz2 samba-0ac7deefbf190e11d38cc47807e0f5f6cfb1775e.zip |
lib/ccan/htable: clean up interface, document htable_type better.
We change from htable_new()/htable_free() to htable_init/htable_clear.
We also change HTABLE_DEFINE_TYPE() to be the full name, without automatically
prepending htable_.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0c3590dc33d644f73bb8587db454c491830aaf26)
Diffstat (limited to 'lib/ccan/htable/test/run-size.c')
-rw-r--r-- | lib/ccan/htable/test/run-size.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ccan/htable/test/run-size.c b/lib/ccan/htable/test/run-size.c index 01e4bb41ac..c92401c3c6 100644 --- a/lib/ccan/htable/test/run-size.c +++ b/lib/ccan/htable/test/run-size.c @@ -16,7 +16,7 @@ static size_t hash(const void *elem, void *unused) int main(int argc, char *argv[]) { - struct htable *ht; + struct htable ht; uint64_t val[NUM_VALS]; unsigned int i; @@ -24,13 +24,13 @@ int main(int argc, char *argv[]) for (i = 0; i < NUM_VALS; i++) val[i] = i; - ht = htable_new(hash, NULL); + htable_init(&ht, hash, NULL); for (i = 0; i < NUM_VALS; i++) { - ok1(ht->max >= i); - ok1(ht->max <= i * 2); - htable_add(ht, hash(&val[i], NULL), &val[i]); + ok1(ht.max >= i); + ok1(ht.max <= i * 2); + htable_add(&ht, hash(&val[i], NULL), &val[i]); } - htable_free(ht); + htable_clear(&ht); return exit_status(); } |