Add temp allocator scribble. Make bufferstream safer.

This commit is contained in:
Christoffer Lerno
2024-08-11 01:17:03 +02:00
parent 224c3f4123
commit 2706495668
3 changed files with 16 additions and 12 deletions

View File

@@ -141,15 +141,9 @@ fn usz! copy_to(InStream in, OutStream dst, char[] buffer = {})
if (&dst.read_to) return dst.read_to(in);
$switch (env::MEMORY_ENV)
$case NORMAL:
@pool()
{
return copy_through_buffer(in, dst, mem::temp_alloc_array(char, 4096));
};
return copy_through_buffer(in, dst, &&char[4096]{});
$case SMALL:
@pool()
{
return copy_through_buffer(in, dst, mem::temp_alloc_array(char, 1024));
};
return copy_through_buffer(in, dst, &&char[1024]{});
$case TINY:
$case NONE:
return copy_through_buffer(in, dst, &&(char[256]{}));