fix (hashmaps): fixed bug that caused PFs and GPFs while handling collisions

This commit is contained in:
antifallobst 2023-06-06 22:27:43 +02:00
parent 8c273f4dc7
commit ae0ef5c85d
2 changed files with 6 additions and 4 deletions

View File

@ -1,10 +1,9 @@
{ {
"PS2_ACPI_VALIDATION": true, "PS2_ACPI_VALIDATION": true,
"LOG_GRAPHICAL": false, "LOG_GRAPHICAL": true,
"drivers": [ "drivers": [
"/initrd/drv/test.nxkm", "/initrd/drv/test.nxkm",
"/initrd/drv/nx_std_fat32.nxkm" "/initrd/drv/nx_std_fat32.nxkm"
], ]
"test": 1
} }

View File

@ -37,10 +37,13 @@ void hashmap_insert(hashmap_T* hashmap, uint64_t key, void* value) {
} }
hashmap_entry_T* entry = &hashmap->entries[index]; hashmap_entry_T* entry = &hashmap->entries[index];
while (entry->next != NULL) entry = entry->next; while (entry->next != NULL) {
entry = entry->next;
}
entry->next = memory_allocate(sizeof(hashmap_entry_T)); entry->next = memory_allocate(sizeof(hashmap_entry_T));
entry->next->prev = entry; entry->next->prev = entry;
entry->next->next = NULL;
entry->next->key = key; entry->next->key = key;
entry->next->value = value; entry->next->value = value;
entry->next->in_use = true; entry->next->in_use = true;