before opti
This commit is contained in:
5
main.c
5
main.c
@@ -30,7 +30,7 @@ void newPerson(person *p, const char *name) {
|
||||
}
|
||||
|
||||
void insert(person **head, person *node) {
|
||||
if (head == NULL) {
|
||||
if (*head == NULL) {
|
||||
*head = node;
|
||||
} else {
|
||||
person *p = *head;
|
||||
@@ -122,7 +122,7 @@ u_long hash(const unsigned char *str) {
|
||||
}
|
||||
|
||||
void hm_insert(person **hashmap, char *name) {
|
||||
u_long hash_value = hash(name);
|
||||
u_long hash_value = hash((unsigned char *)name);
|
||||
hash_value = hash_value % HASH_BUCKETS;
|
||||
sorted_name_insert(&hashmap[hash_value], name);
|
||||
}
|
||||
@@ -187,6 +187,7 @@ void make_list(person **hashmap, person **list, const int min_count) {
|
||||
}
|
||||
p = p_next;
|
||||
}
|
||||
hashmap[i] = NULL;
|
||||
}
|
||||
free(hashmap);
|
||||
}
|
||||
|
Reference in New Issue
Block a user