Allocator_Error.Mode_Not_Implemented; Minor improvement to map runtime procedures

This commit is contained in:
gingerBill
2021-08-08 14:29:45 +01:00
parent a5605e94b1
commit 4d00c2b800
6 changed files with 41 additions and 120 deletions
+5 -4
View File
@@ -276,10 +276,11 @@ Allocator_Query_Info :: struct {
}
Allocator_Error :: enum byte {
None = 0,
Out_Of_Memory = 1,
Invalid_Pointer = 2,
Invalid_Argument = 3,
None = 0,
Out_Of_Memory = 1,
Invalid_Pointer = 2,
Invalid_Argument = 3,
Mode_Not_Implemented = 4,
}
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
+1 -1
View File
@@ -196,6 +196,7 @@ __dynamic_map_rehash :: proc(using header: Map_Header, new_count: int, loc := #c
new_header: Map_Header = header;
nm := Raw_Map{};
nm.entries.allocator = m.entries.allocator;
nm.hashes = m.hashes;
new_header.m = &nm;
c := context;
@@ -239,7 +240,6 @@ __dynamic_map_rehash :: proc(using header: Map_Header, new_count: int, loc := #c
}
}
delete(m.hashes, m.entries.allocator, loc);
free(m.entries.data, m.entries.allocator, loc);
header.m^ = nm;
}