More use of temp allocator.

This commit is contained in:
Christoffer Lerno
2023-07-19 02:46:43 +02:00
parent 5a2fe4c9d9
commit 5c2e82fc8b
7 changed files with 25 additions and 19 deletions

View File

@@ -68,9 +68,9 @@ fn String join(String[] s, String joiner, Allocator* using = mem::heap())
{
total_size += str.len;
}
@stack_mem(256; Allocator* mem)
@pool(using)
{
DString res = dstring::new_with_capacity(total_size, .using = mem);
DString res = dstring::tnew_with_capacity(total_size);
res.append(s[0]);
foreach (String* &str : s[1..])
{
@@ -416,6 +416,9 @@ fn String! from_wstring(WString wstring, Allocator* using = mem::heap())
return from_utf16(utf16, using);
}
fn String! temp_from_wstring(WString wstring) => from_wstring(wstring) @inline;
fn String! temp_from_utf16(Char16[] utf16) => temp_from_utf16(utf16) @inline;
fn usz String.utf8_codepoints(s)
{
usz len = 0;