]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run-size.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / htable / test / run-size.c
index 01e4bb41acf7ad526dde9e5d3f1fa726ddc84f70..090ff99683428b30ac3b070b88a4e2df0238a69f 100644 (file)
@@ -8,15 +8,15 @@
 
 /* We use the number divided by two as the hash (for lots of
    collisions). */
-static size_t hash(const void *elem, void *unused)
+static size_t hash(const void *elem, void *unused UNNEEDED)
 {
        size_t h = *(uint64_t *)elem / 2;
        return h;
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
-       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(&ht) >= i);
+               ok1(ht_max(&ht) <= i * 2);
+               htable_add(&ht, hash(&val[i], NULL), &val[i]);
        }
-       htable_free(ht);
+       htable_clear(&ht);
 
        return exit_status();
 }