mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-17 19:32:23 -07:00
[fmt] Add allocator parameter to fmt.aprintf
This allows you to do `fmt.aprintf("Hello, %v!", name, allocator = ally)`.
This commit is contained in:
+2
-2
@@ -152,9 +152,9 @@ aprintln :: proc(args: ..any, sep := " ") -> string {
|
||||
//
|
||||
// Returns: A formatted string. The returned string must be freed accordingly.
|
||||
//
|
||||
aprintf :: proc(fmt: string, args: ..any) -> string {
|
||||
aprintf :: proc(fmt: string, args: ..any, allocator := context.allocator) -> string {
|
||||
str: strings.Builder
|
||||
strings.builder_init(&str)
|
||||
strings.builder_init(&str, allocator)
|
||||
sbprintf(&str, fmt, ..args)
|
||||
return strings.to_string(str)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user