mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Add Source_Code_Location parameter Allocator_Proc (#138)
This commit is contained in:
+11
-9
@@ -141,6 +141,15 @@ __argv__: ^^u8;
|
|||||||
|
|
||||||
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
|
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
|
||||||
|
|
||||||
|
|
||||||
|
Source_Code_Location :: struct #ordered {
|
||||||
|
file_path: string,
|
||||||
|
line, column: i64,
|
||||||
|
procedure: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Allocator_Mode :: enum u8 {
|
Allocator_Mode :: enum u8 {
|
||||||
Alloc,
|
Alloc,
|
||||||
Free,
|
Free,
|
||||||
@@ -151,7 +160,7 @@ Allocator_Mode :: enum u8 {
|
|||||||
|
|
||||||
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
|
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||||
size, alignment: int,
|
size, alignment: int,
|
||||||
old_memory: rawptr, old_size: int, flags: u64 = 0) -> rawptr;
|
old_memory: rawptr, old_size: int, flags: u64 = 0, location := #caller_location) -> rawptr;
|
||||||
|
|
||||||
|
|
||||||
Allocator :: struct #ordered {
|
Allocator :: struct #ordered {
|
||||||
@@ -172,13 +181,6 @@ Context :: struct #ordered {
|
|||||||
|
|
||||||
DEFAULT_ALIGNMENT :: align_of([vector 4]f32);
|
DEFAULT_ALIGNMENT :: align_of([vector 4]f32);
|
||||||
|
|
||||||
Source_Code_Location :: struct #ordered {
|
|
||||||
file_path: string,
|
|
||||||
line, column: i64,
|
|
||||||
procedure: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__INITIAL_MAP_CAP :: 16;
|
__INITIAL_MAP_CAP :: 16;
|
||||||
|
|
||||||
__Map_Key :: struct #ordered {
|
__Map_Key :: struct #ordered {
|
||||||
@@ -576,7 +578,7 @@ default_resize_align :: proc(old_memory: rawptr, old_size, new_size, alignment:
|
|||||||
|
|
||||||
default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||||
size, alignment: int,
|
size, alignment: int,
|
||||||
old_memory: rawptr, old_size: int, flags: u64) -> rawptr {
|
old_memory: rawptr, old_size: int, flags: u64, location := #caller_location) -> rawptr {
|
||||||
using Allocator_Mode;
|
using Allocator_Mode;
|
||||||
|
|
||||||
switch mode {
|
switch mode {
|
||||||
|
|||||||
+1
-1
@@ -135,7 +135,7 @@ import "core:fmt.odin";
|
|||||||
|
|
||||||
arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
arena_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||||
size, alignment: int,
|
size, alignment: int,
|
||||||
old_memory: rawptr, old_size: int, flags: u64) -> rawptr {
|
old_memory: rawptr, old_size: int, flags: u64, location := #caller_location) -> rawptr {
|
||||||
using Allocator_Mode;
|
using Allocator_Mode;
|
||||||
arena := cast(^Arena)allocator_data;
|
arena := cast(^Arena)allocator_data;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user