Use asserts in dbl_list
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -237,7 +237,7 @@ i64 wapp_str8_find(Str8RO *str, Str8RO substr) { | ||||
|   // NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of | ||||
|   // MSVC Spectre mitigation warnings | ||||
|   u64 char_index = 0; | ||||
|   bool running   = true; | ||||
|   bool running   = char_index < str->size; | ||||
|   while (running) { | ||||
|     const c8 *sub = str->buf + char_index; | ||||
|     if (memcmp(sub, substr.buf, substr.size) == 0) { | ||||
| @@ -259,7 +259,7 @@ i64 wapp_str8_rfind(Str8RO *str, Str8RO substr) { | ||||
|   // NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of | ||||
|   // MSVC Spectre mitigation warnings | ||||
|   i64 char_index = str->size - substr.size; | ||||
|   bool running   = true; | ||||
|   bool running   = char_index >= 0; | ||||
|   while (running) { | ||||
|     const c8 *sub = str->buf + char_index; | ||||
|     if (memcmp(sub, substr.buf, substr.size) == 0) { | ||||
| @@ -302,7 +302,7 @@ Str8List *wapp_str8_split_with_max(const Allocator *allocator, Str8RO *str, Str8 | ||||
|  | ||||
|     before_str     = wapp_str8_alloc_substr(allocator, str, start, start + end); | ||||
|     Str8Node *node = wapp_mem_allocator_alloc(allocator, sizeof(Str8Node)); | ||||
|     if (node) { | ||||
|     if (node && before_str) { | ||||
|       node->item = before_str; | ||||
|       wapp_str8_list_push_back(output, node); | ||||
|     } | ||||
| @@ -317,7 +317,7 @@ Str8List *wapp_str8_split_with_max(const Allocator *allocator, Str8RO *str, Str8 | ||||
|   // Ensure the last part of the string after the delimiter is added to the list | ||||
|   rest           = wapp_str8_alloc_substr(allocator, str, start, str->size); | ||||
|   Str8Node *node = wapp_mem_allocator_alloc(allocator, sizeof(Str8Node)); | ||||
|   if (node) { | ||||
|   if (node && rest) { | ||||
|     node->item = rest; | ||||
|     wapp_str8_list_push_back(output, node); | ||||
|   } | ||||
| @@ -334,7 +334,7 @@ Str8List *wapp_str8_rsplit_with_max(const Allocator *allocator, Str8RO *str, Str | ||||
|   if (delimiter->size > str->size) { | ||||
|     Str8 *full     = wapp_str8_alloc_str8(allocator, str); | ||||
|     Str8Node *node = wapp_mem_allocator_alloc(allocator, sizeof(Str8Node)); | ||||
|     if (node) { | ||||
|     if (node && full) { | ||||
|       node->item = full; | ||||
|       wapp_str8_list_push_back(output, node); | ||||
|     } | ||||
| @@ -367,7 +367,7 @@ Str8List *wapp_str8_rsplit_with_max(const Allocator *allocator, Str8RO *str, Str | ||||
|  | ||||
|   rest           = wapp_str8_alloc_substr(allocator, str, 0, rest->size); | ||||
|   Str8Node *node = wapp_mem_allocator_alloc(allocator, sizeof(Str8Node)); | ||||
|   if (node) { | ||||
|   if (node && rest) { | ||||
|     node->item = rest; | ||||
|     wapp_str8_list_push_front(output, node); | ||||
|   } | ||||
| @@ -386,7 +386,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d | ||||
|   // MSVC Spectre mitigation warnings | ||||
|   Str8Node *node; | ||||
|   u64 node_index = 0; | ||||
|   bool running   = true; | ||||
|   bool running   = node_index < list->node_count; | ||||
|   while (running) { | ||||
|     node = wapp_str8_list_get(list, node_index); | ||||
|     if (!node) { | ||||
| @@ -419,7 +419,7 @@ u64 wapp_str8_list_total_size(const Str8List *list) { | ||||
|   Str8Node* node; | ||||
|   u64 node_index = 0; | ||||
|   u64 output     = 0; | ||||
|   bool running   = true; | ||||
|   bool running   = node_index < list->node_count; | ||||
|   while (running) { | ||||
|       node = wapp_str8_list_get(list, node_index); | ||||
|       if (!node) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user