mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
context.allocator = a; Remove __ from runtime procs; improve division for complex numbers
This commit is contained in:
+1
-4
@@ -110,10 +110,7 @@ make_dynamic_array_len_cap :: proc($T: typeid/[dynamic]$E, auto_cast len: int, a
|
||||
}
|
||||
make_map :: proc($T: typeid/map[$K]$E, auto_cast cap: int = 16, allocator := context.allocator, loc := #caller_location) -> T {
|
||||
runtime.make_map_expr_error_loc(loc, cap);
|
||||
|
||||
c := context;
|
||||
c.allocator = allocator;
|
||||
context = c;
|
||||
context.allocator = allocator;
|
||||
|
||||
m: T;
|
||||
reserve_map(&m, cap);
|
||||
|
||||
+3
-4
@@ -213,14 +213,13 @@ init_arena_from_context :: proc(using a: ^Arena, size: int) {
|
||||
|
||||
|
||||
context_from_allocator :: proc(a: Allocator) -> type_of(context) {
|
||||
c := context;
|
||||
c.allocator = a;
|
||||
return c;
|
||||
context.allocator = a;
|
||||
return context;
|
||||
}
|
||||
|
||||
destroy_arena :: proc(using a: ^Arena) {
|
||||
if backing.procedure != nil {
|
||||
context = context_from_allocator(backing);
|
||||
context.allocator = backing;
|
||||
if memory != nil {
|
||||
free(&memory[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user