mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Merge pull request #3788 from Beefster09/builder-utils
Add to_cstring for Builders
This commit is contained in:
@@ -286,6 +286,20 @@ to_string :: proc(b: Builder) -> (res: string) {
|
|||||||
return string(b.buf[:])
|
return string(b.buf[:])
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
Appends a trailing null byte after the end of the current Builder byte buffer and then casts it to a cstring
|
||||||
|
|
||||||
|
Inputs:
|
||||||
|
- b: A pointer to builder
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
- res: A cstring of the Builder's buffer
|
||||||
|
*/
|
||||||
|
to_cstring :: proc(b: ^Builder) -> (res: cstring) {
|
||||||
|
append(&b.buf, 0)
|
||||||
|
pop(&b.buf)
|
||||||
|
return cstring(raw_data(b.buf))
|
||||||
|
}
|
||||||
|
/*
|
||||||
Returns the length of the Builder's buffer, in bytes
|
Returns the length of the Builder's buffer, in bytes
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
|
|||||||
Reference in New Issue
Block a user