#include #include #include size_t hash(char *); #define GEHASHMAP_NAME funmap #define GEHASHMAP_KEY_T char * #define GEHASHMAP_VAL_T int #define GEHASHMAP_CMP_FUNC (int (*)(char *, char *)) strcmp #define GEHASHMAP_FREE_FUNC (void (*)(char *)) free #define GEHASHMAP_HASH_FUNC hash #include size_t 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_put(map, strdup("Thomas Voß"), 5); funmap_put(map, strdup("THOMAS VOẞ"), 6); funmap_put(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); }