]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/test/run-copy.c
htable: reduce size of htable by calculating max every time.
[ccan] / ccan / htable / test / run-copy.c
index 02d5bbe46856daef1689c784152bee6c218ea806..f8a35006085d6efa5dc96e34f3f5fd0cf0473eb1 100644 (file)
@@ -6,7 +6,7 @@
 
 #define NUM_VALS 512
 
-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;
@@ -17,7 +17,7 @@ static bool cmp(const void *candidate, void *ptr)
        return *(const uint64_t *)candidate == *(const uint64_t *)ptr;
 }
 
-int main(int argc, char *argv[])
+int main(void)
 {
        struct htable ht, ht2;
        uint64_t val[NUM_VALS], i;
@@ -28,8 +28,8 @@ int main(int argc, char *argv[])
 
        htable_init(&ht, hash, NULL);
        for (i = 0; i < NUM_VALS; i++) {
-               ok1(ht.max >= i);
-               ok1(ht.max <= i * 2);
+               ok1(ht_max(&ht) >= i);
+               ok1(ht_max(&ht) <= i * 2);
                htable_add(&ht, hash(&val[i], NULL), &val[i]);
        }