typedef int (*htab_eq) (const void *, const void *); static int eq (const void *a, const void *b) { return a - b; } struct htab { /* Current size (in entries) of the hash table */ int size; /* Pointer to comparison function. */ htab_eq eq_f; /* Table itself. */ void **entries; /* Current number of elements including also deleted elements */ int n_elements; /* Current number of deleted elements in the table */ int n_deleted; /* The following member is used for debugging. Its value is number of all calls of `htab_find_slot' for the hash table. */ unsigned int searches; /* The following member is used for debugging. Its value is number of collisions fixed for time of work with the hash table. */ unsigned int collisions; unsigned int max_size; /* This is non-zero if we are allowed to return NULL for function calls that allocate memory. */ int return_allocation_failure; }; int __attribute__ ((noinline)) test(struct htab *t, int *a, int *b) { int r = t->eq_f (a, b); if (r) return r - 1; return 0; } struct htab mytable; int r; int main(int argc, char **argv) { mytable.eq_f = &eq; for (unsigned i = 0; i < 100000000; i++) r += test (&mytable, &argc, &argc); return 0; }