diff --git a/codegen/array/make_array.py b/codegen/array/make_array.py index 8d10957..7c4e820 100644 --- a/codegen/array/make_array.py +++ b/codegen/array/make_array.py @@ -100,7 +100,11 @@ def make_array(user_datatypes: Dict[CDataType, ArrayData] = {}): source = CSource( name=header.name, decl_types=[*common_decl_types], - includes=[CInclude(header, local=True, same_dir=True), CInclude(header="stddef.h")], + includes=[ + CInclude(header, local=True, same_dir=True), + CInclude(header="stddef.h"), + CInclude(header="assert.h"), + ], internal_funcs=[], funcs=header.funcs ) diff --git a/codegen/array/snippets/alloc_capacity b/codegen/array/snippets/alloc_capacity index 4977ccd..8b0c949 100644 --- a/codegen/array/snippets/alloc_capacity +++ b/codegen/array/snippets/alloc_capacity @@ -1,11 +1,7 @@ + assert(allocator != NULL); + u64 allocation_size = sizeof({ArrayType}) + item_size * capacity; - {ArrayType} *array = NULL; - - if (!allocator) {{ - goto RETURN_GENERIC_ARRAY_ALLOC; - }} - - array = wapp_mem_allocator_alloc(allocator, allocation_size); + {ArrayType} *array = wapp_mem_allocator_alloc(allocator, allocation_size); if (!array) {{ goto RETURN_GENERIC_ARRAY_ALLOC; }} diff --git a/codegen/array/snippets/append_alloc b/codegen/array/snippets/append_alloc index 216a77c..958db8b 100644 --- a/codegen/array/snippets/append_alloc +++ b/codegen/array/snippets/append_alloc @@ -1,8 +1,6 @@ - {ArrayType} *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) {{ - goto RETURN_{Tupper}_ARRAY_APPEND_ALLOC; - }} + {ArrayType} *output = array; if (array->count >= array->capacity) {{ u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); diff --git a/codegen/array/snippets/append_capped b/codegen/array/snippets/append_capped index 17d6100..74939fe 100644 --- a/codegen/array/snippets/append_capped +++ b/codegen/array/snippets/append_capped @@ -1,6 +1,4 @@ - if (!array || array->count >= array->capacity) {{ - return; - }} + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_{Tlower}_array_set(array, index, item); diff --git a/codegen/array/snippets/array_get b/codegen/array/snippets/array_get index b8e5125..962bbc0 100644 --- a/codegen/array/snippets/array_get +++ b/codegen/array/snippets/array_get @@ -1,6 +1,4 @@ - if (!array || index >= array->count) {{ - return NULL; - }} + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return ({T} *)ptr; diff --git a/codegen/array/snippets/array_set b/codegen/array/snippets/array_set index bacedc8..f570d92 100644 --- a/codegen/array/snippets/array_set +++ b/codegen/array/snippets/array_set @@ -1,6 +1,3 @@ {T} *ptr = wapp_{Tlower}_array_get(array, index); - if (!ptr) {{ - return; - }} memcpy((void *)ptr, (void *)item, array->item_size); diff --git a/codegen/array/snippets/clear b/codegen/array/snippets/clear index 5ae2d50..9166b42 100644 --- a/codegen/array/snippets/clear +++ b/codegen/array/snippets/clear @@ -1,5 +1,2 @@ - if (!array) {{ - return; - }} - + assert(array != NULL); array->count = 0; diff --git a/codegen/array/snippets/copy_alloc b/codegen/array/snippets/copy_alloc index 32e9fc9..f45a1b4 100644 --- a/codegen/array/snippets/copy_alloc +++ b/codegen/array/snippets/copy_alloc @@ -1,8 +1,6 @@ - {ArrayType} *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) {{ - goto RETURN_{Tupper}_ARRAY_COPY_ALLOC; - }} + {ArrayType} *output = dst; if (src->count >= dst->capacity) {{ u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); diff --git a/codegen/array/snippets/copy_capped b/codegen/array/snippets/copy_capped index 4bb1961..455dbdc 100644 --- a/codegen/array/snippets/copy_capped +++ b/codegen/array/snippets/copy_capped @@ -1,6 +1,4 @@ - if (!src || !dst) {{ - return; - }} + assert(src != NULL && dst != NULL); wapp_{Tlower}_array_clear(dst); diff --git a/codegen/array/snippets/extend_alloc b/codegen/array/snippets/extend_alloc index 1db2c12..91700c8 100644 --- a/codegen/array/snippets/extend_alloc +++ b/codegen/array/snippets/extend_alloc @@ -1,8 +1,6 @@ - {ArrayType} *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) {{ - goto RETURN_{Tupper}_ARRAY_EXTEND_ALLOC; - }} + {ArrayType} *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) {{ diff --git a/codegen/array/snippets/extend_capped b/codegen/array/snippets/extend_capped index 89c772f..cbf7dec 100644 --- a/codegen/array/snippets/extend_capped +++ b/codegen/array/snippets/extend_capped @@ -1,11 +1,7 @@ - if (!array || !other) {{ - return; - }} + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) {{ - return; - }} + assert(other->count < remaining_capacity); {T} *item; diff --git a/src/primitives/array/array.c b/src/primitives/array/array.c index b761a41..4a02ffe 100644 --- a/src/primitives/array/array.c +++ b/src/primitives/array/array.c @@ -8,12 +8,11 @@ #include "../../common/aliases/aliases.h" #include "../../common/platform/platform.h" #include +#include #include Str8 *wapp_str8_array_get(const Str8Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (Str8 *)ptr; @@ -21,31 +20,22 @@ Str8 *wapp_str8_array_get(const Str8Array *array, u64 index) { void wapp_str8_array_set(Str8Array *array, u64 index, Str8 *item) { Str8 *ptr = wapp_str8_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_str8_array_append_capped(Str8Array *array, Str8 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_str8_array_set(array, index, item); } void wapp_str8_array_extend_capped(Str8Array *array, const Str8Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); Str8 *item; @@ -68,17 +58,12 @@ void wapp_str8_array_extend_capped(Str8Array *array, const Str8Array *other) { } void wapp_str8_array_clear(Str8Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_str8_array_copy_capped(const Str8Array *src, Str8Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_str8_array_clear(dst); @@ -103,11 +88,9 @@ void wapp_str8_array_copy_capped(const Str8Array *src, Str8Array *dst) { } Str8Array *wapp_str8_array_append_alloc(const Allocator *allocator, Str8Array *array, Str8 *item) { - Str8Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_STR8_ARRAY_APPEND_ALLOC; - } + Str8Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -126,11 +109,9 @@ RETURN_STR8_ARRAY_APPEND_ALLOC: } Str8Array *wapp_str8_array_extend_alloc(const Allocator *allocator, Str8Array *array, const Str8Array *other) { - Str8Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_STR8_ARRAY_EXTEND_ALLOC; - } + Str8Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -150,11 +131,9 @@ RETURN_STR8_ARRAY_EXTEND_ALLOC: } Str8Array *wapp_str8_array_copy_alloc(const Allocator *allocator, const Str8Array *src, Str8Array *dst) { - Str8Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_STR8_ARRAY_COPY_ALLOC; - } + Str8Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -180,9 +159,7 @@ Str8 *_str8_array_pop(Str8Array *array) { } void * *wapp_void_ptr_array_get(const VoidPArray *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (void * *)ptr; @@ -190,31 +167,22 @@ void * *wapp_void_ptr_array_get(const VoidPArray *array, u64 index) { void wapp_void_ptr_array_set(VoidPArray *array, u64 index, void * *item) { void * *ptr = wapp_void_ptr_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_void_ptr_array_append_capped(VoidPArray *array, void * *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_void_ptr_array_set(array, index, item); } void wapp_void_ptr_array_extend_capped(VoidPArray *array, const VoidPArray *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); void * *item; @@ -237,17 +205,12 @@ void wapp_void_ptr_array_extend_capped(VoidPArray *array, const VoidPArray *othe } void wapp_void_ptr_array_clear(VoidPArray *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_void_ptr_array_copy_capped(const VoidPArray *src, VoidPArray *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_void_ptr_array_clear(dst); @@ -272,11 +235,9 @@ void wapp_void_ptr_array_copy_capped(const VoidPArray *src, VoidPArray *dst) { } VoidPArray *wapp_void_ptr_array_append_alloc(const Allocator *allocator, VoidPArray *array, void * *item) { - VoidPArray *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_VOID_PTR_ARRAY_APPEND_ALLOC; - } + VoidPArray *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -295,11 +256,9 @@ RETURN_VOID_PTR_ARRAY_APPEND_ALLOC: } VoidPArray *wapp_void_ptr_array_extend_alloc(const Allocator *allocator, VoidPArray *array, const VoidPArray *other) { - VoidPArray *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_VOID_PTR_ARRAY_EXTEND_ALLOC; - } + VoidPArray *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -319,11 +278,9 @@ RETURN_VOID_PTR_ARRAY_EXTEND_ALLOC: } VoidPArray *wapp_void_ptr_array_copy_alloc(const Allocator *allocator, const VoidPArray *src, VoidPArray *dst) { - VoidPArray *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_VOID_PTR_ARRAY_COPY_ALLOC; - } + VoidPArray *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -349,9 +306,7 @@ void * *_void_ptr_array_pop(VoidPArray *array) { } bool *wapp_bool_array_get(const BoolArray *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (bool *)ptr; @@ -359,31 +314,22 @@ bool *wapp_bool_array_get(const BoolArray *array, u64 index) { void wapp_bool_array_set(BoolArray *array, u64 index, bool *item) { bool *ptr = wapp_bool_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_bool_array_append_capped(BoolArray *array, bool *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_bool_array_set(array, index, item); } void wapp_bool_array_extend_capped(BoolArray *array, const BoolArray *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); bool *item; @@ -406,17 +352,12 @@ void wapp_bool_array_extend_capped(BoolArray *array, const BoolArray *other) { } void wapp_bool_array_clear(BoolArray *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_bool_array_copy_capped(const BoolArray *src, BoolArray *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_bool_array_clear(dst); @@ -441,11 +382,9 @@ void wapp_bool_array_copy_capped(const BoolArray *src, BoolArray *dst) { } BoolArray *wapp_bool_array_append_alloc(const Allocator *allocator, BoolArray *array, bool *item) { - BoolArray *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_BOOL_ARRAY_APPEND_ALLOC; - } + BoolArray *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -464,11 +403,9 @@ RETURN_BOOL_ARRAY_APPEND_ALLOC: } BoolArray *wapp_bool_array_extend_alloc(const Allocator *allocator, BoolArray *array, const BoolArray *other) { - BoolArray *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_BOOL_ARRAY_EXTEND_ALLOC; - } + BoolArray *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -488,11 +425,9 @@ RETURN_BOOL_ARRAY_EXTEND_ALLOC: } BoolArray *wapp_bool_array_copy_alloc(const Allocator *allocator, const BoolArray *src, BoolArray *dst) { - BoolArray *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_BOOL_ARRAY_COPY_ALLOC; - } + BoolArray *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -518,9 +453,7 @@ bool *_bool_array_pop(BoolArray *array) { } char *wapp_char_array_get(const CharArray *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (char *)ptr; @@ -528,31 +461,22 @@ char *wapp_char_array_get(const CharArray *array, u64 index) { void wapp_char_array_set(CharArray *array, u64 index, char *item) { char *ptr = wapp_char_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_char_array_append_capped(CharArray *array, char *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_char_array_set(array, index, item); } void wapp_char_array_extend_capped(CharArray *array, const CharArray *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); char *item; @@ -575,17 +499,12 @@ void wapp_char_array_extend_capped(CharArray *array, const CharArray *other) { } void wapp_char_array_clear(CharArray *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_char_array_copy_capped(const CharArray *src, CharArray *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_char_array_clear(dst); @@ -610,11 +529,9 @@ void wapp_char_array_copy_capped(const CharArray *src, CharArray *dst) { } CharArray *wapp_char_array_append_alloc(const Allocator *allocator, CharArray *array, char *item) { - CharArray *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_CHAR_ARRAY_APPEND_ALLOC; - } + CharArray *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -633,11 +550,9 @@ RETURN_CHAR_ARRAY_APPEND_ALLOC: } CharArray *wapp_char_array_extend_alloc(const Allocator *allocator, CharArray *array, const CharArray *other) { - CharArray *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_CHAR_ARRAY_EXTEND_ALLOC; - } + CharArray *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -657,11 +572,9 @@ RETURN_CHAR_ARRAY_EXTEND_ALLOC: } CharArray *wapp_char_array_copy_alloc(const Allocator *allocator, const CharArray *src, CharArray *dst) { - CharArray *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_CHAR_ARRAY_COPY_ALLOC; - } + CharArray *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -687,9 +600,7 @@ char *_char_array_pop(CharArray *array) { } c8 *wapp_c8_array_get(const C8Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (c8 *)ptr; @@ -697,31 +608,22 @@ c8 *wapp_c8_array_get(const C8Array *array, u64 index) { void wapp_c8_array_set(C8Array *array, u64 index, c8 *item) { c8 *ptr = wapp_c8_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_c8_array_append_capped(C8Array *array, c8 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_c8_array_set(array, index, item); } void wapp_c8_array_extend_capped(C8Array *array, const C8Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); c8 *item; @@ -744,17 +646,12 @@ void wapp_c8_array_extend_capped(C8Array *array, const C8Array *other) { } void wapp_c8_array_clear(C8Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_c8_array_copy_capped(const C8Array *src, C8Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_c8_array_clear(dst); @@ -779,11 +676,9 @@ void wapp_c8_array_copy_capped(const C8Array *src, C8Array *dst) { } C8Array *wapp_c8_array_append_alloc(const Allocator *allocator, C8Array *array, c8 *item) { - C8Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_C8_ARRAY_APPEND_ALLOC; - } + C8Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -802,11 +697,9 @@ RETURN_C8_ARRAY_APPEND_ALLOC: } C8Array *wapp_c8_array_extend_alloc(const Allocator *allocator, C8Array *array, const C8Array *other) { - C8Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_C8_ARRAY_EXTEND_ALLOC; - } + C8Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -826,11 +719,9 @@ RETURN_C8_ARRAY_EXTEND_ALLOC: } C8Array *wapp_c8_array_copy_alloc(const Allocator *allocator, const C8Array *src, C8Array *dst) { - C8Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_C8_ARRAY_COPY_ALLOC; - } + C8Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -856,9 +747,7 @@ c8 *_c8_array_pop(C8Array *array) { } c16 *wapp_c16_array_get(const C16Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (c16 *)ptr; @@ -866,31 +755,22 @@ c16 *wapp_c16_array_get(const C16Array *array, u64 index) { void wapp_c16_array_set(C16Array *array, u64 index, c16 *item) { c16 *ptr = wapp_c16_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_c16_array_append_capped(C16Array *array, c16 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_c16_array_set(array, index, item); } void wapp_c16_array_extend_capped(C16Array *array, const C16Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); c16 *item; @@ -913,17 +793,12 @@ void wapp_c16_array_extend_capped(C16Array *array, const C16Array *other) { } void wapp_c16_array_clear(C16Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_c16_array_copy_capped(const C16Array *src, C16Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_c16_array_clear(dst); @@ -948,11 +823,9 @@ void wapp_c16_array_copy_capped(const C16Array *src, C16Array *dst) { } C16Array *wapp_c16_array_append_alloc(const Allocator *allocator, C16Array *array, c16 *item) { - C16Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_C16_ARRAY_APPEND_ALLOC; - } + C16Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -971,11 +844,9 @@ RETURN_C16_ARRAY_APPEND_ALLOC: } C16Array *wapp_c16_array_extend_alloc(const Allocator *allocator, C16Array *array, const C16Array *other) { - C16Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_C16_ARRAY_EXTEND_ALLOC; - } + C16Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -995,11 +866,9 @@ RETURN_C16_ARRAY_EXTEND_ALLOC: } C16Array *wapp_c16_array_copy_alloc(const Allocator *allocator, const C16Array *src, C16Array *dst) { - C16Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_C16_ARRAY_COPY_ALLOC; - } + C16Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1025,9 +894,7 @@ c16 *_c16_array_pop(C16Array *array) { } c32 *wapp_c32_array_get(const C32Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (c32 *)ptr; @@ -1035,31 +902,22 @@ c32 *wapp_c32_array_get(const C32Array *array, u64 index) { void wapp_c32_array_set(C32Array *array, u64 index, c32 *item) { c32 *ptr = wapp_c32_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_c32_array_append_capped(C32Array *array, c32 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_c32_array_set(array, index, item); } void wapp_c32_array_extend_capped(C32Array *array, const C32Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); c32 *item; @@ -1082,17 +940,12 @@ void wapp_c32_array_extend_capped(C32Array *array, const C32Array *other) { } void wapp_c32_array_clear(C32Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_c32_array_copy_capped(const C32Array *src, C32Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_c32_array_clear(dst); @@ -1117,11 +970,9 @@ void wapp_c32_array_copy_capped(const C32Array *src, C32Array *dst) { } C32Array *wapp_c32_array_append_alloc(const Allocator *allocator, C32Array *array, c32 *item) { - C32Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_C32_ARRAY_APPEND_ALLOC; - } + C32Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1140,11 +991,9 @@ RETURN_C32_ARRAY_APPEND_ALLOC: } C32Array *wapp_c32_array_extend_alloc(const Allocator *allocator, C32Array *array, const C32Array *other) { - C32Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_C32_ARRAY_EXTEND_ALLOC; - } + C32Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -1164,11 +1013,9 @@ RETURN_C32_ARRAY_EXTEND_ALLOC: } C32Array *wapp_c32_array_copy_alloc(const Allocator *allocator, const C32Array *src, C32Array *dst) { - C32Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_C32_ARRAY_COPY_ALLOC; - } + C32Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1194,9 +1041,7 @@ c32 *_c32_array_pop(C32Array *array) { } i8 *wapp_i8_array_get(const I8Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (i8 *)ptr; @@ -1204,31 +1049,22 @@ i8 *wapp_i8_array_get(const I8Array *array, u64 index) { void wapp_i8_array_set(I8Array *array, u64 index, i8 *item) { i8 *ptr = wapp_i8_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_i8_array_append_capped(I8Array *array, i8 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_i8_array_set(array, index, item); } void wapp_i8_array_extend_capped(I8Array *array, const I8Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); i8 *item; @@ -1251,17 +1087,12 @@ void wapp_i8_array_extend_capped(I8Array *array, const I8Array *other) { } void wapp_i8_array_clear(I8Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_i8_array_copy_capped(const I8Array *src, I8Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_i8_array_clear(dst); @@ -1286,11 +1117,9 @@ void wapp_i8_array_copy_capped(const I8Array *src, I8Array *dst) { } I8Array *wapp_i8_array_append_alloc(const Allocator *allocator, I8Array *array, i8 *item) { - I8Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_I8_ARRAY_APPEND_ALLOC; - } + I8Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1309,11 +1138,9 @@ RETURN_I8_ARRAY_APPEND_ALLOC: } I8Array *wapp_i8_array_extend_alloc(const Allocator *allocator, I8Array *array, const I8Array *other) { - I8Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_I8_ARRAY_EXTEND_ALLOC; - } + I8Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -1333,11 +1160,9 @@ RETURN_I8_ARRAY_EXTEND_ALLOC: } I8Array *wapp_i8_array_copy_alloc(const Allocator *allocator, const I8Array *src, I8Array *dst) { - I8Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_I8_ARRAY_COPY_ALLOC; - } + I8Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1363,9 +1188,7 @@ i8 *_i8_array_pop(I8Array *array) { } i16 *wapp_i16_array_get(const I16Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (i16 *)ptr; @@ -1373,31 +1196,22 @@ i16 *wapp_i16_array_get(const I16Array *array, u64 index) { void wapp_i16_array_set(I16Array *array, u64 index, i16 *item) { i16 *ptr = wapp_i16_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_i16_array_append_capped(I16Array *array, i16 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_i16_array_set(array, index, item); } void wapp_i16_array_extend_capped(I16Array *array, const I16Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); i16 *item; @@ -1420,17 +1234,12 @@ void wapp_i16_array_extend_capped(I16Array *array, const I16Array *other) { } void wapp_i16_array_clear(I16Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_i16_array_copy_capped(const I16Array *src, I16Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_i16_array_clear(dst); @@ -1455,11 +1264,9 @@ void wapp_i16_array_copy_capped(const I16Array *src, I16Array *dst) { } I16Array *wapp_i16_array_append_alloc(const Allocator *allocator, I16Array *array, i16 *item) { - I16Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_I16_ARRAY_APPEND_ALLOC; - } + I16Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1478,11 +1285,9 @@ RETURN_I16_ARRAY_APPEND_ALLOC: } I16Array *wapp_i16_array_extend_alloc(const Allocator *allocator, I16Array *array, const I16Array *other) { - I16Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_I16_ARRAY_EXTEND_ALLOC; - } + I16Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -1502,11 +1307,9 @@ RETURN_I16_ARRAY_EXTEND_ALLOC: } I16Array *wapp_i16_array_copy_alloc(const Allocator *allocator, const I16Array *src, I16Array *dst) { - I16Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_I16_ARRAY_COPY_ALLOC; - } + I16Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1532,9 +1335,7 @@ i16 *_i16_array_pop(I16Array *array) { } i32 *wapp_i32_array_get(const I32Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (i32 *)ptr; @@ -1542,31 +1343,22 @@ i32 *wapp_i32_array_get(const I32Array *array, u64 index) { void wapp_i32_array_set(I32Array *array, u64 index, i32 *item) { i32 *ptr = wapp_i32_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_i32_array_append_capped(I32Array *array, i32 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_i32_array_set(array, index, item); } void wapp_i32_array_extend_capped(I32Array *array, const I32Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); i32 *item; @@ -1589,17 +1381,12 @@ void wapp_i32_array_extend_capped(I32Array *array, const I32Array *other) { } void wapp_i32_array_clear(I32Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_i32_array_copy_capped(const I32Array *src, I32Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_i32_array_clear(dst); @@ -1624,11 +1411,9 @@ void wapp_i32_array_copy_capped(const I32Array *src, I32Array *dst) { } I32Array *wapp_i32_array_append_alloc(const Allocator *allocator, I32Array *array, i32 *item) { - I32Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_I32_ARRAY_APPEND_ALLOC; - } + I32Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1647,11 +1432,9 @@ RETURN_I32_ARRAY_APPEND_ALLOC: } I32Array *wapp_i32_array_extend_alloc(const Allocator *allocator, I32Array *array, const I32Array *other) { - I32Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_I32_ARRAY_EXTEND_ALLOC; - } + I32Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -1671,11 +1454,9 @@ RETURN_I32_ARRAY_EXTEND_ALLOC: } I32Array *wapp_i32_array_copy_alloc(const Allocator *allocator, const I32Array *src, I32Array *dst) { - I32Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_I32_ARRAY_COPY_ALLOC; - } + I32Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1701,9 +1482,7 @@ i32 *_i32_array_pop(I32Array *array) { } i64 *wapp_i64_array_get(const I64Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (i64 *)ptr; @@ -1711,31 +1490,22 @@ i64 *wapp_i64_array_get(const I64Array *array, u64 index) { void wapp_i64_array_set(I64Array *array, u64 index, i64 *item) { i64 *ptr = wapp_i64_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_i64_array_append_capped(I64Array *array, i64 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_i64_array_set(array, index, item); } void wapp_i64_array_extend_capped(I64Array *array, const I64Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); i64 *item; @@ -1758,17 +1528,12 @@ void wapp_i64_array_extend_capped(I64Array *array, const I64Array *other) { } void wapp_i64_array_clear(I64Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_i64_array_copy_capped(const I64Array *src, I64Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_i64_array_clear(dst); @@ -1793,11 +1558,9 @@ void wapp_i64_array_copy_capped(const I64Array *src, I64Array *dst) { } I64Array *wapp_i64_array_append_alloc(const Allocator *allocator, I64Array *array, i64 *item) { - I64Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_I64_ARRAY_APPEND_ALLOC; - } + I64Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1816,11 +1579,9 @@ RETURN_I64_ARRAY_APPEND_ALLOC: } I64Array *wapp_i64_array_extend_alloc(const Allocator *allocator, I64Array *array, const I64Array *other) { - I64Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_I64_ARRAY_EXTEND_ALLOC; - } + I64Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -1840,11 +1601,9 @@ RETURN_I64_ARRAY_EXTEND_ALLOC: } I64Array *wapp_i64_array_copy_alloc(const Allocator *allocator, const I64Array *src, I64Array *dst) { - I64Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_I64_ARRAY_COPY_ALLOC; - } + I64Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -1870,9 +1629,7 @@ i64 *_i64_array_pop(I64Array *array) { } u8 *wapp_u8_array_get(const U8Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (u8 *)ptr; @@ -1880,31 +1637,22 @@ u8 *wapp_u8_array_get(const U8Array *array, u64 index) { void wapp_u8_array_set(U8Array *array, u64 index, u8 *item) { u8 *ptr = wapp_u8_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_u8_array_append_capped(U8Array *array, u8 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_u8_array_set(array, index, item); } void wapp_u8_array_extend_capped(U8Array *array, const U8Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); u8 *item; @@ -1927,17 +1675,12 @@ void wapp_u8_array_extend_capped(U8Array *array, const U8Array *other) { } void wapp_u8_array_clear(U8Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_u8_array_copy_capped(const U8Array *src, U8Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_u8_array_clear(dst); @@ -1962,11 +1705,9 @@ void wapp_u8_array_copy_capped(const U8Array *src, U8Array *dst) { } U8Array *wapp_u8_array_append_alloc(const Allocator *allocator, U8Array *array, u8 *item) { - U8Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_U8_ARRAY_APPEND_ALLOC; - } + U8Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -1985,11 +1726,9 @@ RETURN_U8_ARRAY_APPEND_ALLOC: } U8Array *wapp_u8_array_extend_alloc(const Allocator *allocator, U8Array *array, const U8Array *other) { - U8Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_U8_ARRAY_EXTEND_ALLOC; - } + U8Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2009,11 +1748,9 @@ RETURN_U8_ARRAY_EXTEND_ALLOC: } U8Array *wapp_u8_array_copy_alloc(const Allocator *allocator, const U8Array *src, U8Array *dst) { - U8Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_U8_ARRAY_COPY_ALLOC; - } + U8Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2039,9 +1776,7 @@ u8 *_u8_array_pop(U8Array *array) { } u16 *wapp_u16_array_get(const U16Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (u16 *)ptr; @@ -2049,31 +1784,22 @@ u16 *wapp_u16_array_get(const U16Array *array, u64 index) { void wapp_u16_array_set(U16Array *array, u64 index, u16 *item) { u16 *ptr = wapp_u16_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_u16_array_append_capped(U16Array *array, u16 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_u16_array_set(array, index, item); } void wapp_u16_array_extend_capped(U16Array *array, const U16Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); u16 *item; @@ -2096,17 +1822,12 @@ void wapp_u16_array_extend_capped(U16Array *array, const U16Array *other) { } void wapp_u16_array_clear(U16Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_u16_array_copy_capped(const U16Array *src, U16Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_u16_array_clear(dst); @@ -2131,11 +1852,9 @@ void wapp_u16_array_copy_capped(const U16Array *src, U16Array *dst) { } U16Array *wapp_u16_array_append_alloc(const Allocator *allocator, U16Array *array, u16 *item) { - U16Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_U16_ARRAY_APPEND_ALLOC; - } + U16Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2154,11 +1873,9 @@ RETURN_U16_ARRAY_APPEND_ALLOC: } U16Array *wapp_u16_array_extend_alloc(const Allocator *allocator, U16Array *array, const U16Array *other) { - U16Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_U16_ARRAY_EXTEND_ALLOC; - } + U16Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2178,11 +1895,9 @@ RETURN_U16_ARRAY_EXTEND_ALLOC: } U16Array *wapp_u16_array_copy_alloc(const Allocator *allocator, const U16Array *src, U16Array *dst) { - U16Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_U16_ARRAY_COPY_ALLOC; - } + U16Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2208,9 +1923,7 @@ u16 *_u16_array_pop(U16Array *array) { } u32 *wapp_u32_array_get(const U32Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (u32 *)ptr; @@ -2218,31 +1931,22 @@ u32 *wapp_u32_array_get(const U32Array *array, u64 index) { void wapp_u32_array_set(U32Array *array, u64 index, u32 *item) { u32 *ptr = wapp_u32_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_u32_array_append_capped(U32Array *array, u32 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_u32_array_set(array, index, item); } void wapp_u32_array_extend_capped(U32Array *array, const U32Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); u32 *item; @@ -2265,17 +1969,12 @@ void wapp_u32_array_extend_capped(U32Array *array, const U32Array *other) { } void wapp_u32_array_clear(U32Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_u32_array_copy_capped(const U32Array *src, U32Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_u32_array_clear(dst); @@ -2300,11 +1999,9 @@ void wapp_u32_array_copy_capped(const U32Array *src, U32Array *dst) { } U32Array *wapp_u32_array_append_alloc(const Allocator *allocator, U32Array *array, u32 *item) { - U32Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_U32_ARRAY_APPEND_ALLOC; - } + U32Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2323,11 +2020,9 @@ RETURN_U32_ARRAY_APPEND_ALLOC: } U32Array *wapp_u32_array_extend_alloc(const Allocator *allocator, U32Array *array, const U32Array *other) { - U32Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_U32_ARRAY_EXTEND_ALLOC; - } + U32Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2347,11 +2042,9 @@ RETURN_U32_ARRAY_EXTEND_ALLOC: } U32Array *wapp_u32_array_copy_alloc(const Allocator *allocator, const U32Array *src, U32Array *dst) { - U32Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_U32_ARRAY_COPY_ALLOC; - } + U32Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2377,9 +2070,7 @@ u32 *_u32_array_pop(U32Array *array) { } u64 *wapp_u64_array_get(const U64Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (u64 *)ptr; @@ -2387,31 +2078,22 @@ u64 *wapp_u64_array_get(const U64Array *array, u64 index) { void wapp_u64_array_set(U64Array *array, u64 index, u64 *item) { u64 *ptr = wapp_u64_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_u64_array_append_capped(U64Array *array, u64 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_u64_array_set(array, index, item); } void wapp_u64_array_extend_capped(U64Array *array, const U64Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); u64 *item; @@ -2434,17 +2116,12 @@ void wapp_u64_array_extend_capped(U64Array *array, const U64Array *other) { } void wapp_u64_array_clear(U64Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_u64_array_copy_capped(const U64Array *src, U64Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_u64_array_clear(dst); @@ -2469,11 +2146,9 @@ void wapp_u64_array_copy_capped(const U64Array *src, U64Array *dst) { } U64Array *wapp_u64_array_append_alloc(const Allocator *allocator, U64Array *array, u64 *item) { - U64Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_U64_ARRAY_APPEND_ALLOC; - } + U64Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2492,11 +2167,9 @@ RETURN_U64_ARRAY_APPEND_ALLOC: } U64Array *wapp_u64_array_extend_alloc(const Allocator *allocator, U64Array *array, const U64Array *other) { - U64Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_U64_ARRAY_EXTEND_ALLOC; - } + U64Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2516,11 +2189,9 @@ RETURN_U64_ARRAY_EXTEND_ALLOC: } U64Array *wapp_u64_array_copy_alloc(const Allocator *allocator, const U64Array *src, U64Array *dst) { - U64Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_U64_ARRAY_COPY_ALLOC; - } + U64Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2546,9 +2217,7 @@ u64 *_u64_array_pop(U64Array *array) { } f32 *wapp_f32_array_get(const F32Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (f32 *)ptr; @@ -2556,31 +2225,22 @@ f32 *wapp_f32_array_get(const F32Array *array, u64 index) { void wapp_f32_array_set(F32Array *array, u64 index, f32 *item) { f32 *ptr = wapp_f32_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_f32_array_append_capped(F32Array *array, f32 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_f32_array_set(array, index, item); } void wapp_f32_array_extend_capped(F32Array *array, const F32Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); f32 *item; @@ -2603,17 +2263,12 @@ void wapp_f32_array_extend_capped(F32Array *array, const F32Array *other) { } void wapp_f32_array_clear(F32Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_f32_array_copy_capped(const F32Array *src, F32Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_f32_array_clear(dst); @@ -2638,11 +2293,9 @@ void wapp_f32_array_copy_capped(const F32Array *src, F32Array *dst) { } F32Array *wapp_f32_array_append_alloc(const Allocator *allocator, F32Array *array, f32 *item) { - F32Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_F32_ARRAY_APPEND_ALLOC; - } + F32Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2661,11 +2314,9 @@ RETURN_F32_ARRAY_APPEND_ALLOC: } F32Array *wapp_f32_array_extend_alloc(const Allocator *allocator, F32Array *array, const F32Array *other) { - F32Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_F32_ARRAY_EXTEND_ALLOC; - } + F32Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2685,11 +2336,9 @@ RETURN_F32_ARRAY_EXTEND_ALLOC: } F32Array *wapp_f32_array_copy_alloc(const Allocator *allocator, const F32Array *src, F32Array *dst) { - F32Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_F32_ARRAY_COPY_ALLOC; - } + F32Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2715,9 +2364,7 @@ f32 *_f32_array_pop(F32Array *array) { } f64 *wapp_f64_array_get(const F64Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (f64 *)ptr; @@ -2725,31 +2372,22 @@ f64 *wapp_f64_array_get(const F64Array *array, u64 index) { void wapp_f64_array_set(F64Array *array, u64 index, f64 *item) { f64 *ptr = wapp_f64_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_f64_array_append_capped(F64Array *array, f64 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_f64_array_set(array, index, item); } void wapp_f64_array_extend_capped(F64Array *array, const F64Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); f64 *item; @@ -2772,17 +2410,12 @@ void wapp_f64_array_extend_capped(F64Array *array, const F64Array *other) { } void wapp_f64_array_clear(F64Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_f64_array_copy_capped(const F64Array *src, F64Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_f64_array_clear(dst); @@ -2807,11 +2440,9 @@ void wapp_f64_array_copy_capped(const F64Array *src, F64Array *dst) { } F64Array *wapp_f64_array_append_alloc(const Allocator *allocator, F64Array *array, f64 *item) { - F64Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_F64_ARRAY_APPEND_ALLOC; - } + F64Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2830,11 +2461,9 @@ RETURN_F64_ARRAY_APPEND_ALLOC: } F64Array *wapp_f64_array_extend_alloc(const Allocator *allocator, F64Array *array, const F64Array *other) { - F64Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_F64_ARRAY_EXTEND_ALLOC; - } + F64Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -2854,11 +2483,9 @@ RETURN_F64_ARRAY_EXTEND_ALLOC: } F64Array *wapp_f64_array_copy_alloc(const Allocator *allocator, const F64Array *src, F64Array *dst) { - F64Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_F64_ARRAY_COPY_ALLOC; - } + F64Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -2884,9 +2511,7 @@ f64 *_f64_array_pop(F64Array *array) { } f128 *wapp_f128_array_get(const F128Array *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (f128 *)ptr; @@ -2894,31 +2519,22 @@ f128 *wapp_f128_array_get(const F128Array *array, u64 index) { void wapp_f128_array_set(F128Array *array, u64 index, f128 *item) { f128 *ptr = wapp_f128_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_f128_array_append_capped(F128Array *array, f128 *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_f128_array_set(array, index, item); } void wapp_f128_array_extend_capped(F128Array *array, const F128Array *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); f128 *item; @@ -2941,17 +2557,12 @@ void wapp_f128_array_extend_capped(F128Array *array, const F128Array *other) { } void wapp_f128_array_clear(F128Array *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_f128_array_copy_capped(const F128Array *src, F128Array *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_f128_array_clear(dst); @@ -2976,11 +2587,9 @@ void wapp_f128_array_copy_capped(const F128Array *src, F128Array *dst) { } F128Array *wapp_f128_array_append_alloc(const Allocator *allocator, F128Array *array, f128 *item) { - F128Array *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_F128_ARRAY_APPEND_ALLOC; - } + F128Array *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -2999,11 +2608,9 @@ RETURN_F128_ARRAY_APPEND_ALLOC: } F128Array *wapp_f128_array_extend_alloc(const Allocator *allocator, F128Array *array, const F128Array *other) { - F128Array *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_F128_ARRAY_EXTEND_ALLOC; - } + F128Array *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -3023,11 +2630,9 @@ RETURN_F128_ARRAY_EXTEND_ALLOC: } F128Array *wapp_f128_array_copy_alloc(const Allocator *allocator, const F128Array *src, F128Array *dst) { - F128Array *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_F128_ARRAY_COPY_ALLOC; - } + F128Array *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -3053,9 +2658,7 @@ f128 *_f128_array_pop(F128Array *array) { } iptr *wapp_iptr_array_get(const IptrArray *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (iptr *)ptr; @@ -3063,31 +2666,22 @@ iptr *wapp_iptr_array_get(const IptrArray *array, u64 index) { void wapp_iptr_array_set(IptrArray *array, u64 index, iptr *item) { iptr *ptr = wapp_iptr_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_iptr_array_append_capped(IptrArray *array, iptr *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_iptr_array_set(array, index, item); } void wapp_iptr_array_extend_capped(IptrArray *array, const IptrArray *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); iptr *item; @@ -3110,17 +2704,12 @@ void wapp_iptr_array_extend_capped(IptrArray *array, const IptrArray *other) { } void wapp_iptr_array_clear(IptrArray *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_iptr_array_copy_capped(const IptrArray *src, IptrArray *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_iptr_array_clear(dst); @@ -3145,11 +2734,9 @@ void wapp_iptr_array_copy_capped(const IptrArray *src, IptrArray *dst) { } IptrArray *wapp_iptr_array_append_alloc(const Allocator *allocator, IptrArray *array, iptr *item) { - IptrArray *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_IPTR_ARRAY_APPEND_ALLOC; - } + IptrArray *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -3168,11 +2755,9 @@ RETURN_IPTR_ARRAY_APPEND_ALLOC: } IptrArray *wapp_iptr_array_extend_alloc(const Allocator *allocator, IptrArray *array, const IptrArray *other) { - IptrArray *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_IPTR_ARRAY_EXTEND_ALLOC; - } + IptrArray *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -3192,11 +2777,9 @@ RETURN_IPTR_ARRAY_EXTEND_ALLOC: } IptrArray *wapp_iptr_array_copy_alloc(const Allocator *allocator, const IptrArray *src, IptrArray *dst) { - IptrArray *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_IPTR_ARRAY_COPY_ALLOC; - } + IptrArray *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -3222,9 +2805,7 @@ iptr *_iptr_array_pop(IptrArray *array) { } uptr *wapp_uptr_array_get(const UptrArray *array, u64 index) { - if (!array || index >= array->count) { - return NULL; - } + assert(array != NULL & index < array->count); u8 *ptr = (u8 *)(array->items) + (array->item_size * index); return (uptr *)ptr; @@ -3232,31 +2813,22 @@ uptr *wapp_uptr_array_get(const UptrArray *array, u64 index) { void wapp_uptr_array_set(UptrArray *array, u64 index, uptr *item) { uptr *ptr = wapp_uptr_array_get(array, index); - if (!ptr) { - return; - } memcpy((void *)ptr, (void *)item, array->item_size); } void wapp_uptr_array_append_capped(UptrArray *array, uptr *item) { - if (!array || array->count >= array->capacity) { - return; - } + assert(array != NULL && array->count < array->capacity); u64 index = (array->count)++; wapp_uptr_array_set(array, index, item); } void wapp_uptr_array_extend_capped(UptrArray *array, const UptrArray *other) { - if (!array || !other) { - return; - } + assert(array != NULL && other != NULL); u64 remaining_capacity = array->capacity - array->count; - if (other->count >= remaining_capacity) { - return; - } + assert(other->count < remaining_capacity); uptr *item; @@ -3279,17 +2851,12 @@ void wapp_uptr_array_extend_capped(UptrArray *array, const UptrArray *other) { } void wapp_uptr_array_clear(UptrArray *array) { - if (!array) { - return; - } - + assert(array != NULL); array->count = 0; } void wapp_uptr_array_copy_capped(const UptrArray *src, UptrArray *dst) { - if (!src || !dst) { - return; - } + assert(src != NULL && dst != NULL); wapp_uptr_array_clear(dst); @@ -3314,11 +2881,9 @@ void wapp_uptr_array_copy_capped(const UptrArray *src, UptrArray *dst) { } UptrArray *wapp_uptr_array_append_alloc(const Allocator *allocator, UptrArray *array, uptr *item) { - UptrArray *output = array; + assert(allocator != NULL && array != NULL); - if (!allocator || !array) { - goto RETURN_UPTR_ARRAY_APPEND_ALLOC; - } + UptrArray *output = array; if (array->count >= array->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2); @@ -3337,11 +2902,9 @@ RETURN_UPTR_ARRAY_APPEND_ALLOC: } UptrArray *wapp_uptr_array_extend_alloc(const Allocator *allocator, UptrArray *array, const UptrArray *other) { - UptrArray *output = array; + assert(allocator != NULL && array != NULL && other != NULL); - if (!allocator || !array || !other) { - goto RETURN_UPTR_ARRAY_EXTEND_ALLOC; - } + UptrArray *output = array; u64 remaining_capacity = array->capacity - array->count; if (other->count >= remaining_capacity) { @@ -3361,11 +2924,9 @@ RETURN_UPTR_ARRAY_EXTEND_ALLOC: } UptrArray *wapp_uptr_array_copy_alloc(const Allocator *allocator, const UptrArray *src, UptrArray *dst) { - UptrArray *output = dst; + assert(allocator != NULL & src != NULL && dst != NULL); - if (!allocator || !src || !dst) { - goto RETURN_UPTR_ARRAY_COPY_ALLOC; - } + UptrArray *output = dst; if (src->count >= dst->capacity) { u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2); @@ -3391,14 +2952,10 @@ uptr *_uptr_array_pop(UptrArray *array) { } VoidPArray *_array_alloc_capacity(const Allocator *allocator, u64 capacity, u64 item_size) { + assert(allocator != NULL); + u64 allocation_size = sizeof(VoidPArray) + item_size * capacity; - VoidPArray *array = NULL; - - if (!allocator) { - goto RETURN_GENERIC_ARRAY_ALLOC; - } - - array = wapp_mem_allocator_alloc(allocator, allocation_size); + VoidPArray *array = wapp_mem_allocator_alloc(allocator, allocation_size); if (!array) { goto RETURN_GENERIC_ARRAY_ALLOC; } diff --git a/tests/array/test_i32_array.c b/tests/array/test_i32_array.c index b9102d3..f8f82d4 100644 --- a/tests/array/test_i32_array.c +++ b/tests/array/test_i32_array.c @@ -86,7 +86,6 @@ TestFuncResult test_i32_array_append_capped(void) { array = wapp_i32_array(1); wapp_i32_array_append_capped(&array, &((i32){10})); - wapp_i32_array_append_capped(&array, &((i32){20})); result = result && array.count == 2; @@ -105,10 +104,6 @@ TestFuncResult test_i32_array_extend_capped(void) { result = result && array1.count == 6; - wapp_i32_array_extend_capped(&array1, &array1); - - result = result && array1.count == 6; - return wapp_tester_result(result); }