Using arena as token array, remove arenas idea
This commit is contained in:
@@ -91,7 +91,7 @@ string_fmtv(Allocator *a, const char *str, va_list args1) {
|
||||
va_end(args2);
|
||||
|
||||
char *result = allocate_array(a, char, len + 1);
|
||||
stbsp_vsnprintf(result, len + 1, str, args1);
|
||||
stbsp_vsnprintf(result, (int)(len + 1), str, args1);
|
||||
|
||||
String res = {(U8 *)result, len};
|
||||
return res;
|
||||
@@ -187,7 +187,7 @@ struct String_Builder{
|
||||
char *write_address = (char *)block->data + block->len;
|
||||
|
||||
va_copy(args2, args);
|
||||
int written = stbsp_vsnprintf(write_address, block_size, str, args2);
|
||||
int written = stbsp_vsnprintf(write_address, (int)block_size, str, args2);
|
||||
va_end(args2);
|
||||
|
||||
if(written > (block_size-1)){
|
||||
@@ -348,7 +348,7 @@ string_trim_end(String string) {
|
||||
CORE_Static String
|
||||
string_to_lower_case(Allocator *arena, String s) {
|
||||
String copy = string_copy(arena, s);
|
||||
for (U64 i = 0; i < copy.len; i++) {
|
||||
for (S64 i = 0; i < copy.len; i++) {
|
||||
copy.str[i] = to_lower_case(copy.str[i]);
|
||||
}
|
||||
return copy;
|
||||
@@ -357,7 +357,7 @@ string_to_lower_case(Allocator *arena, String s) {
|
||||
CORE_Static String
|
||||
string_to_upper_case(Allocator *arena, String s) {
|
||||
String copy = string_copy(arena, s);
|
||||
for (U64 i = 0; i < copy.len; i++) {
|
||||
for (S64 i = 0; i < copy.len; i++) {
|
||||
copy.str[i] = to_upper_case(copy.str[i]);
|
||||
}
|
||||
return copy;
|
||||
@@ -455,10 +455,10 @@ struct String_Replace {
|
||||
};
|
||||
|
||||
CORE_Static String
|
||||
string_replace(Scratch_Arena *scratch, Allocator *allocator, String string, Array<String_Replace> pairs){
|
||||
string_replace(Arena *scratch, Allocator *allocator, String string, Array<String_Replace> pairs){
|
||||
Scratch_Scope _scope(scratch);
|
||||
String_Builder builder = {scratch};
|
||||
for(int i = 0; i < string.len; i++){
|
||||
for(S64 i = 0; i < string.len; i++){
|
||||
For(pairs){
|
||||
String current = string_skip(string, i);
|
||||
current = string_get_prefix(current, it.find.len);
|
||||
|
||||
Reference in New Issue
Block a user