mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Merge pull request #5672 from thetarnav/strings-builder-caller-location
Add missing caller location param to append in strings builder
This commit is contained in:
@@ -296,8 +296,8 @@ Inputs:
|
|||||||
Returns:
|
Returns:
|
||||||
- res: A cstring of the Builder's buffer
|
- res: A cstring of the Builder's buffer
|
||||||
*/
|
*/
|
||||||
unsafe_to_cstring :: proc(b: ^Builder) -> (res: cstring) {
|
unsafe_to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring) {
|
||||||
append(&b.buf, 0)
|
append(&b.buf, 0, loc)
|
||||||
pop(&b.buf)
|
pop(&b.buf)
|
||||||
return cstring(raw_data(b.buf))
|
return cstring(raw_data(b.buf))
|
||||||
}
|
}
|
||||||
@@ -311,8 +311,8 @@ Returns:
|
|||||||
- res: A cstring of the Builder's buffer upon success
|
- res: A cstring of the Builder's buffer upon success
|
||||||
- err: An optional allocator error if one occured, `nil` otherwise
|
- err: An optional allocator error if one occured, `nil` otherwise
|
||||||
*/
|
*/
|
||||||
to_cstring :: proc(b: ^Builder) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error {
|
to_cstring :: proc(b: ^Builder, loc := #caller_location) -> (res: cstring, err: mem.Allocator_Error) #optional_allocator_error {
|
||||||
n := append(&b.buf, 0) or_return
|
n := append(&b.buf, 0, loc) or_return
|
||||||
if n != 1 {
|
if n != 1 {
|
||||||
return nil, .Out_Of_Memory
|
return nil, .Out_Of_Memory
|
||||||
}
|
}
|
||||||
@@ -518,9 +518,9 @@ Output:
|
|||||||
abc
|
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)
|
n0 := len(b.buf)
|
||||||
append(&b.buf, s)
|
append(&b.buf, s, loc)
|
||||||
n1 := len(b.buf)
|
n1 := len(b.buf)
|
||||||
return n1-n0
|
return n1-n0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user