diff options
| author | Tetralux <tetraluxonpc@gmail.com> | 2023-10-02 02:44:55 +0000 |
|---|---|---|
| committer | Tetralux <tetraluxonpc@gmail.com> | 2023-10-02 02:46:26 +0000 |
| commit | 7a6ac3ea92557c81639e8153ef030e05b1ee1a04 (patch) | |
| tree | 5b02f2f2f2983d43679597ddd1a0f194d3d05cef | |
| parent | 2370884722c9638cf0ba3916a8a54247096bb4f6 (diff) | |
[fmt] Add allocator parameter to `fmt.aprintf`
This allows you to do `fmt.aprintf("Hello, %v!", name, allocator = ally)`.
| -rw-r--r-- | core/fmt/fmt.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index ab57209c3..04a5676c0 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -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) } |