Introduce the allocator stuff again

This commit is contained in:
Krzosa Karol
2022-12-31 16:51:01 +01:00
parent e20edaa3a2
commit 55515ff420
12 changed files with 71 additions and 44 deletions

View File

@@ -77,7 +77,7 @@ operator==(String a, String b){
CORE_Static String
string_copy(Arena *a, String string){
U8 *copy = arena_push_array(a, U8, string.len+1);
U8 *copy = allocate_array(a, U8, string.len+1);
memory_copy(copy, string.str, string.len);
copy[string.len] = 0;
return String{copy, string.len};
@@ -90,7 +90,7 @@ string_fmtv(Arena *a, const char *str, va_list args1) {
S64 len = stbsp_vsnprintf(0, 0, str, args2);
va_end(args2);
char *result = arena_push_array(a, char, len + 1);
char *result = allocate_array(a, char, len + 1);
stbsp_vsnprintf(result, len + 1, str, args1);
String res = {(U8 *)result, len};