diff options
| author | Pix <ben.dennis@hyprfire.com> | 2023-08-15 12:30:40 +0800 |
|---|---|---|
| committer | Pix <ben.dennis@hyprfire.com> | 2023-08-15 12:30:40 +0800 |
| commit | 0cf9c22033a28283feecbd8f9d4cc0720be7d5b4 (patch) | |
| tree | c65b3f3072fc51e80d02c7b62e77e405c1e5e723 /core/strings | |
| parent | 589820639c38979f4c801e8edcbb62c21ca15099 (diff) | |
Builder makes added caller location
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/builder.odin | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/core/strings/builder.odin b/core/strings/builder.odin index 28c56f6f9..d87626d07 100644 --- a/core/strings/builder.odin +++ b/core/strings/builder.odin @@ -35,8 +35,8 @@ Returns: - res: The new Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_make_none :: proc(allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { - return Builder{buf=make([dynamic]byte, allocator) or_return }, nil +builder_make_none :: proc(allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { + return Builder{buf=make([dynamic]byte, allocator, loc) or_return }, nil } /* Produces a Builder with a specified length and cap of max(16,len) byte buffer @@ -51,8 +51,8 @@ Returns: - res: The new Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_make_len :: proc(len: int, allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { - return Builder{buf=make([dynamic]byte, len, allocator) or_return }, nil +builder_make_len :: proc(len: int, allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { + return Builder{buf=make([dynamic]byte, len, allocator, loc) or_return }, nil } /* Produces a Builder with a specified length and cap @@ -68,8 +68,8 @@ Returns: - res: The new Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_make_len_cap :: proc(len, cap: int, allocator := context.allocator) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { - return Builder{buf=make([dynamic]byte, len, cap, allocator) or_return }, nil +builder_make_len_cap :: proc(len, cap: int, allocator := context.allocator, loc := #caller_location) -> (res: Builder, err: mem.Allocator_Error) #optional_allocator_error { + return Builder{buf=make([dynamic]byte, len, cap, allocator, loc) or_return }, nil } /* Produces a String Builder @@ -116,8 +116,8 @@ Returns: - res: A pointer to the initialized Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_init_none :: proc(b: ^Builder, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { - b.buf = make([dynamic]byte, allocator) or_return +builder_init_none :: proc(b: ^Builder, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { + b.buf = make([dynamic]byte, allocator, loc) or_return return b, nil } /* @@ -135,8 +135,8 @@ Returns: - res: A pointer to the initialized Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_init_len :: proc(b: ^Builder, len: int, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { - b.buf = make([dynamic]byte, len, allocator) or_return +builder_init_len :: proc(b: ^Builder, len: int, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { + b.buf = make([dynamic]byte, len, allocator, loc) or_return return b, nil } /* @@ -153,8 +153,8 @@ Returns: - res: A pointer to the initialized Builder - err: An optional allocator error if one occured, `nil` otherwise */ -builder_init_len_cap :: proc(b: ^Builder, len, cap: int, allocator := context.allocator) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { - b.buf = make([dynamic]byte, len, cap, allocator) or_return +builder_init_len_cap :: proc(b: ^Builder, len, cap: int, allocator := context.allocator, loc := #caller_location) -> (res: ^Builder, err: mem.Allocator_Error) #optional_allocator_error { + b.buf = make([dynamic]byte, len, cap, allocator, loc) or_return return b, nil } // Overload simple `builder_init_*` with or without len / ap parameters |