Replacing core allocation stuff, still need to rewrite map and token

structures
This commit is contained in:
Krzosa Karol
2022-10-10 00:05:38 +02:00
parent 13f2f20ea6
commit 2f153a7cd3
9 changed files with 43 additions and 36 deletions

View File

@@ -76,8 +76,8 @@ operator==(String a, String b){
}
function String
string_copy(Allocator *a, String string){
U8 *copy = exp_alloc_array(a, U8, string.len+1);
string_copy(Arena *a, String string){
U8 *copy = arena_push_array(a, U8, string.len+1);
memory_copy(copy, string.str, string.len);
copy[string.len] = 0;
return String{copy, string.len};
@@ -368,7 +368,7 @@ string_trim_end(String string) {
}
function String
string_to_lower_case(Allocator *arena, String s) {
string_to_lower_case(Arena *arena, String s) {
String copy = string_copy(arena, s);
for (U64 i = 0; i < copy.len; i++) {
copy.str[i] = to_lower_case(copy.str[i]);
@@ -377,7 +377,7 @@ string_to_lower_case(Allocator *arena, String s) {
}
function String
string_to_upper_case(Allocator *arena, String s) {
string_to_upper_case(Arena *arena, String s) {
String copy = string_copy(arena, s);
for (U64 i = 0; i < copy.len; i++) {
copy.str[i] = to_upper_case(copy.str[i]);