| 113 | } |
| 114 | |
| 115 | static void rehash(struct hashmap *map, unsigned int newsize) |
| 116 | { |
| 117 | /* map->table MUST NOT be NULL when this function is called */ |
| 118 | unsigned int i, oldsize = map->tablesize; |
| 119 | struct hashmap_entry **oldtable = map->table; |
| 120 | |
| 121 | alloc_table(map, newsize); |
| 122 | for (i = 0; i < oldsize; i++) { |
| 123 | struct hashmap_entry *e = oldtable[i]; |
| 124 | while (e) { |
| 125 | struct hashmap_entry *next = e->next; |
| 126 | unsigned int b = bucket(map, e); |
| 127 | e->next = map->table[b]; |
| 128 | map->table[b] = e; |
| 129 | e = next; |
| 130 | } |
| 131 | } |
| 132 | free(oldtable); |
| 133 | } |
| 134 | |
| 135 | static inline struct hashmap_entry **find_entry_ptr(const struct hashmap *map, |
| 136 | const struct hashmap_entry *key, const void *keydata) |
no test coverage detected