4 * processing incoming connections.
13 @@ -196,6 +199,7 @@ static void child_main (struct child_s *
19 while (!config.quit) {
20 ptr->status = T_WAITING;
24 * don't try to free the data, or realloc the memory. :)
32 @@ -50,6 +52,7 @@ struct hashbucket_s {
38 hashmap_iter end_iterator;
40 @@ -65,7 +68,7 @@ struct hashmap_s {
42 * If any of the arguments are invalid a negative number is returned.
44 -static int hashfunc (const char *key, unsigned int size)
45 +static int hashfunc (const char *key, unsigned int size, uint32_t seed)
49 @@ -74,7 +77,7 @@ static int hashfunc (const char *key, un
53 - for (hash = tolower (*key++); *key != '\0'; key++) {
54 + for (hash = seed; *key != '\0'; key++) {
55 uint32_t bit = (hash & 1) ? (1 << (sizeof (uint32_t) - 1)) : 0;
58 @@ -104,6 +107,7 @@ hashmap_t hashmap_create (unsigned int n
62 + ptr->seed = (uint32_t)rand();
64 ptr->buckets = (struct hashbucket_s *) safecalloc (nbuckets,
66 @@ -201,7 +205,7 @@ hashmap_insert (hashmap_t map, const cha
70 - hash = hashfunc (key, map->size);
71 + hash = hashfunc (key, map->size, map->seed);
75 @@ -382,7 +386,7 @@ ssize_t hashmap_search (hashmap_t map, c
76 if (map == NULL || key == NULL)
79 - hash = hashfunc (key, map->size);
80 + hash = hashfunc (key, map->size, map->seed);
84 @@ -416,7 +420,7 @@ ssize_t hashmap_entry_by_key (hashmap_t
85 if (!map || !key || !data)
88 - hash = hashfunc (key, map->size);
89 + hash = hashfunc (key, map->size, map->seed);
93 @@ -451,7 +455,7 @@ ssize_t hashmap_remove (hashmap_t map, c
94 if (map == NULL || key == NULL)
97 - hash = hashfunc (key, map->size);
98 + hash = hashfunc (key, map->size, map->seed);