Removed the use of temp allocator in backtrace printing.

Added string::bformat.
This commit is contained in:
Christoffer Lerno
2025-07-13 02:38:45 +02:00
committed by Christoffer Lerno
parent 6c7dc2a28e
commit e755c36ea2
13 changed files with 272 additions and 150 deletions

View File

@@ -107,6 +107,19 @@ fn String format(Allocator allocator, String fmt, args...) @format(1) => @pool()
return str.copy_str(allocator);
}
<*
Return a new String created using the formatting function.
@param [inout] buffer : `The buffer to use`
@param [in] fmt : `The formatting string`
*>
fn String bformat(char[] buffer, String fmt, args...) @format(1)
{
DString str = dstring::new_with_capacity(allocator::wrap(buffer), fmt.len + args.len * 8);
str.appendf(fmt, ...args);
return str.str_view();
}
<*
Return a temporary String created using the formatting function.