Skip to content

Commit 72f8baf

Browse files
authored
Merge pull request #5672 from thetarnav/strings-builder-caller-location
Add missing caller location param to append in strings builder
2 parents cf4262d + 413b44d commit 72f8baf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/strings/builder.odin

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ Inputs:
296296
Returns:
297297
- res: A cstring of the Builder's buffer
298298
*/
299-
unsafe_to_cstring :: proc(b: ^Builder) -> (res: cstring) {
300-
append(&b.buf, 0)
299+
unsafe_to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring) {
300+
append(&b.buf, 0, loc)
301301
pop(&b.buf)
302302
return cstring(raw_data(b.buf))
303303
}
@@ -311,8 +311,8 @@ Returns:
311311
- res: A cstring of the Builder's buffer upon success
312312
- err: An optional allocator error if one occured, `nil` otherwise
313313
*/
314-
to_cstring :: proc(b: ^Builder) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error {
315-
n := append(&b.buf, 0) or_return
314+
to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error {
315+
n := append(&b.buf, 0, loc) or_return
316316
if n != 1 {
317317
return nil, .Out_Of_Memory
318318
}
@@ -518,9 +518,9 @@ Output:
518518
abc
519519
520520
*/
521-
write_string :: proc(b: ^Builder, s: string) -> (n: int) {
521+
write_string :: proc(b: ^Builder, s: string, loc := #caller_location) -> (n: int) {
522522
n0 := len(b.buf)
523-
append(&b.buf, s)
523+
append(&b.buf, s, loc)
524524
n1 := len(b.buf)
525525
return n1-n0
526526
}

0 commit comments

Comments
 (0)