mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Removed the use of temp allocator in backtrace printing.
Added string::bformat.
This commit is contained in:
committed by
Christoffer Lerno
parent
6c7dc2a28e
commit
e755c36ea2
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user