diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-09-11 11:02:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-11 11:02:35 +0100 |
| commit | 72f8bafe6caef7079fe852e2b5d985fb363f97d7 (patch) | |
| tree | c14b7f4d8d79a89ac823a49ed97e072a4fa2fc0e | |
| parent | cf4262d22cdd14ffa3cfb129179634a2d82d44d7 (diff) | |
| parent | 413b44d05cfb592b4797492a934c7b084f9f4024 (diff) | |
Merge pull request #5672 from thetarnav/strings-builder-caller-location
Add missing caller location param to append in strings builder
| -rw-r--r-- | core/strings/builder.odin | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/strings/builder.odin b/core/strings/builder.odin index b1180d5e9..285ced9ce 100644 --- a/core/strings/builder.odin +++ b/core/strings/builder.odin @@ -296,8 +296,8 @@ Inputs: Returns: - res: A cstring of the Builder's buffer */ -unsafe_to_cstring :: proc(b: ^Builder) -> (res: cstring) { - append(&b.buf, 0) +unsafe_to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring) { + append(&b.buf, 0, loc) pop(&b.buf) return cstring(raw_data(b.buf)) } @@ -311,8 +311,8 @@ Returns: - res: A cstring of the Builder's buffer upon success - err: An optional allocator error if one occured, `nil` otherwise */ -to_cstring :: proc(b: ^Builder) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error { - n := append(&b.buf, 0) or_return +to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error { + n := append(&b.buf, 0, loc) or_return if n != 1 { return nil, .Out_Of_Memory } @@ -518,9 +518,9 @@ Output: abc */ -write_string :: proc(b: ^Builder, s: string) -> (n: int) { +write_string :: proc(b: ^Builder, s: string, loc := #caller_location) -> (n: int) { n0 := len(b.buf) - append(&b.buf, s) + append(&b.buf, s, loc) n1 := len(b.buf) return n1-n0 } |