Working on simplifying the allocation scheme

This commit is contained in:
Krzosa Karol
2023-01-01 10:48:06 +01:00
parent d10b72057e
commit 8c0a8bf72b
9 changed files with 126 additions and 98 deletions

View File

@@ -159,7 +159,7 @@ utf16_to_utf32(U16 *c, S32 max_advance) {
}
CORE_Static String32
string16_to_string32(Arena *allocator, String16 string){
string16_to_string32(Allocator *allocator, String16 string){
String32 result = {allocate_array(allocator, U32, string.len+1)};
for(S64 i = 0; i < string.len;){
UTF32_Result decode = utf16_to_utf32(string.str + i, string.len - i);
@@ -175,7 +175,7 @@ string16_to_string32(Arena *allocator, String16 string){
}
CORE_Static String32
string8_to_string32(Arena *allocator, String string){
string8_to_string32(Allocator *allocator, String string){
String32 result = {allocate_array(allocator, U32, string.len+1)};
for(S64 i = 0; i < string.len;){
UTF32_Result decode = utf8_to_utf32(string.str + i, string.len - i);
@@ -190,7 +190,7 @@ string8_to_string32(Arena *allocator, String string){
}
CORE_Static String16
string8_to_string16(Arena *allocator, String in){
string8_to_string16(Allocator *allocator, String in){
String16 result = {allocate_array(allocator, U16, (in.len*2)+1)}; // @Note(Krzosa): Should be more then enough space
for(S64 i = 0; i < in.len;){
UTF32_Result decode = utf8_to_utf32(in.str + i, in.len - i);
@@ -212,7 +212,7 @@ string8_to_string16(Arena *allocator, String in){
}
CORE_Static String
string16_to_string8(Arena *allocator, String16 in){
string16_to_string8(Allocator *allocator, String16 in){
String result = {allocate_array(allocator, U8, in.len*4+1)};
for(S64 i = 0; i < in.len;){
UTF32_Result decode = utf16_to_utf32(in.str + i, in.len - i);
@@ -266,7 +266,7 @@ string16_from_widechar(wchar_t *string){
}
CORE_Static String
string16_copy(Arena *a, String string){
string16_copy(Allocator *a, String string){
U8 *copy = allocate_array(a, U8, string.len+1);
memory_copy(copy, string.str, string.len);
copy[string.len] = 0;