return e->key + strlen(e->key) + 1;
}
-static int test_entry_cmp(const struct test_entry *e1,
- const struct test_entry *e2, const char* key)
+static int test_entry_cmp(const void *unused_cmp_data,
+ const struct test_entry *e1,
+ const struct test_entry *e2,
+ const char* key)
{
return strcmp(e1->key, key ? key : e2->key);
}
-static int test_entry_cmp_icase(const struct test_entry *e1,
- const struct test_entry *e2, const char* key)
+static int test_entry_cmp_icase(const void *unused_cmp_data,
+ const struct test_entry *e1,
+ const struct test_entry *e2,
+ const char* key)
{
return strcasecmp(e1->key, key ? key : e2->key);
}
if (method & TEST_ADD) {
/* test adding to the map */
for (j = 0; j < rounds; j++) {
- hashmap_init(&map, (hashmap_cmp_fn) test_entry_cmp, 0);
+ hashmap_init(&map, (hashmap_cmp_fn) test_entry_cmp,
+ NULL, 0);
/* add entries */
for (i = 0; i < TEST_SIZE; i++) {
}
} else {
/* test map lookups */
- hashmap_init(&map, (hashmap_cmp_fn) test_entry_cmp, 0);
+ hashmap_init(&map, (hashmap_cmp_fn) test_entry_cmp, NULL, 0);
/* fill the map (sparsely if specified) */
j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE;
*
* perfhashmap method rounds -> test hashmap.[ch] performance
*/
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
char line[1024];
struct hashmap map;
/* init hash map */
icase = argc > 1 && !strcmp("ignorecase", argv[1]);
hashmap_init(&map, (hashmap_cmp_fn) (icase ? test_entry_cmp_icase
- : test_entry_cmp), 0);
+ : test_entry_cmp), NULL, 0);
/* process commands from stdin */
while (fgets(line, sizeof(line), stdin)) {