mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 13:25:19 +00:00
Add allocator parameter to fmt's aprint and aprintln
This commit is contained in:
@@ -120,9 +120,9 @@ register_user_formatter :: proc(id: typeid, formatter: User_Formatter) -> Regist
|
||||
//
|
||||
// Returns: A formatted string.
|
||||
//
|
||||
aprint :: proc(args: ..any, sep := " ") -> string {
|
||||
aprint :: proc(args: ..any, sep := " ", allocator := context.allocator) -> string {
|
||||
str: strings.Builder
|
||||
strings.builder_init(&str)
|
||||
strings.builder_init(&str, allocator)
|
||||
sbprint(&str, ..args, sep=sep)
|
||||
return strings.to_string(str)
|
||||
}
|
||||
@@ -136,9 +136,9 @@ aprint :: proc(args: ..any, sep := " ") -> string {
|
||||
//
|
||||
// Returns: A formatted string with a newline character at the end.
|
||||
//
|
||||
aprintln :: proc(args: ..any, sep := " ") -> string {
|
||||
aprintln :: proc(args: ..any, sep := " ", allocator := context.allocator) -> string {
|
||||
str: strings.Builder
|
||||
strings.builder_init(&str)
|
||||
strings.builder_init(&str, allocator)
|
||||
sbprintln(&str, ..args, sep=sep)
|
||||
return strings.to_string(str)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user