Introducing List and changes in base

This commit is contained in:
Krzosa Karol
2022-09-30 09:40:56 +02:00
parent 5e149dfca3
commit cf619c2ea3
7 changed files with 299 additions and 354 deletions

View File

@@ -151,7 +151,7 @@ struct String_Builder{
}
memory_zero(block, sizeof(String_Builder_Block)+1); // Also clear first byte of character data
block->cap = size;
SLLQueuePush(first, last, block);
SLL_QUEUE_ADD(first, last, block);
}
void init(S64 size = 4096){
@@ -219,7 +219,7 @@ string_flatten(Allocator *a, String_Builder *b, String_Builder_Flag flags = Stri
// @Note(Krzosa): Compute size to allocate
S64 size = 1;
if(is_flag_set(flags, String_Builder_Flag_AddSize)) size += sizeof(SizeU);
For_List(b->first){
For_Linked_List(b->first){
size += it->len;
}
@@ -231,7 +231,7 @@ string_flatten(Allocator *a, String_Builder *b, String_Builder_Flag flags = Stri
}
// @Note(Krzosa): Copy the content of each block into the string
For_List(b->first){
For_Linked_List(b->first){
memory_copy(result.str + result.len, it->data, it->len);
result.len += it->len;
}