#include #include #include #include GEHASHMAP_API(char *, int, funmap); GEHASHMAP_IMPL(char *, int, funmap); bool funmap_key_iseq(char *a, char *b) { return strcmp(a, b) == 0; } void funmap_key_free(char *s) { free(s); } size_t funmap_key_hash(char *s) { char c; size_t x = 5381; while (c = *s++) x = ((x << 5) + x) + c; return x; } int main(void) { int n; funmap_t *map; funmap_new(map = malloc(sizeof(funmap_t))); funmap_set(map, strdup("Thomas Voß"), 5); funmap_set(map, strdup("THOMAS VOẞ"), 6); funmap_set(map, strdup("Thomas Voss"), 7); funmap_get(map, "Thomas Voß", &n); printf("Thomas Voß -> ‚%d‘\n", n); funmap_get(map, "THOMAS VOẞ", &n); printf("THOMAS VOẞ -> ‚%d‘\n", n); funmap_get(map, "Thomas Voss", &n); printf("Thomas Voss -> ‚%d‘\n", n); funmap_free(map); free(map); }