Remove text from asserts

This commit is contained in:
2025-05-05 19:29:44 +01:00
parent be30189d15
commit 175f627f93
9 changed files with 30 additions and 30 deletions

View File

@@ -4,23 +4,23 @@
#include <assert.h>
void *wapp_mem_allocator_alloc(const Allocator *allocator, u64 size) {
assert(allocator != NULL && (allocator->alloc) != NULL && "allocator argument shouldn't be NULL");
assert(allocator != NULL && (allocator->alloc) != NULL);
return allocator->alloc(size, allocator->obj);
}
void *wapp_mem_allocator_alloc_aligned(const Allocator *allocator, u64 size, u64 alignment) {
assert(allocator != NULL && (allocator->alloc_aligned) != NULL && "allocator argument shouldn't be NULL");
assert(allocator != NULL && (allocator->alloc_aligned) != NULL);
return allocator->alloc_aligned(size, alignment, allocator->obj);
}
void *wapp_mem_allocator_realloc(const Allocator *allocator, void *ptr, u64 old_size, u64 new_size) {
assert(allocator != NULL && (allocator->realloc) != NULL && "allocator argument shouldn't be NULL");
assert(allocator != NULL && (allocator->realloc) != NULL);
return allocator->realloc(ptr, old_size, new_size, allocator->obj);
}
void *wapp_mem_allocator_realloc_aligned(const Allocator *allocator, void *ptr, u64 old_size,
u64 new_size, u64 alignment) {
assert(allocator != NULL && (allocator->realloc_aligned) != NULL && "allocator argument shouldn't be NULL");
assert(allocator != NULL && (allocator->realloc_aligned) != NULL);
return allocator->realloc_aligned(ptr, old_size, new_size, alignment, allocator->obj);
}

View File

@@ -11,7 +11,7 @@
#define STR8_BUF_ALLOC_SIZE(CAPACITY) (sizeof(Str8) + sizeof(c8) * CAPACITY)
Str8 *wapp_str8_alloc_buf(const Allocator *allocator, u64 capacity) {
assert(allocator != NULL && "allocator argument shouldn't be NULL");
assert(allocator != NULL);
Str8 *str = wapp_mem_allocator_alloc(allocator, STR8_BUF_ALLOC_SIZE(capacity));
if (!str) {
@@ -27,7 +27,7 @@ RETURN_STR8:
}
Str8 *wapp_str8_alloc_cstr(const Allocator *allocator, const char *str) {
assert(allocator != NULL && str != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL);
u64 length = strlen(str);
Str8 *output = wapp_str8_alloc_buf(allocator, length * 2);
@@ -43,7 +43,7 @@ RETURN_ALLOC_CSTR:
}
Str8 *wapp_str8_alloc_str8(const Allocator *allocator, Str8RO *str) {
assert(allocator != NULL && str != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL);
Str8 *output = wapp_str8_alloc_buf(allocator, str->capacity);
if (!output) {
@@ -58,7 +58,7 @@ RETURN_ALLOC_STR8:
}
Str8 *wapp_str8_alloc_substr(const Allocator *allocator, Str8RO *str, u64 start, u64 end) {
assert(allocator != NULL && str != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL);
Str8 *output = NULL;
@@ -83,7 +83,7 @@ RETURN_ALLOC_SUBSTR:
}
void wapp_str8_dealloc_buf(const Allocator *allocator, Str8 **str) {
assert(allocator != NULL && str != NULL && (*str) != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL && (*str) != NULL);
wapp_mem_allocator_free(allocator, (void **)str, STR8_BUF_ALLOC_SIZE((*str)->capacity));
}
@@ -146,7 +146,7 @@ Str8 wapp_str8_slice(Str8RO *str, u64 start, u64 end) {
}
Str8 *wapp_str8_alloc_concat(const Allocator *allocator, Str8 *dst, Str8RO *src) {
assert(allocator != NULL && dst != NULL && src != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && dst != NULL && src != NULL);
Str8 *output = NULL;
u64 remaining = dst->capacity - dst->size;
@@ -172,7 +172,7 @@ RETURN_STR8_CONCAT:
}
void wapp_str8_concat_capped(Str8 *dst, Str8RO *src) {
assert(dst != NULL && src != NULL && "Arguments passed shouldn't be NULL");
assert(dst != NULL && src != NULL);
u64 remaining = dst->capacity - dst->size;
u64 to_copy = remaining < src->size ? remaining : src->size;
@@ -182,7 +182,7 @@ void wapp_str8_concat_capped(Str8 *dst, Str8RO *src) {
}
void wapp_str8_copy_cstr_capped(Str8 *dst, const char *src) {
assert(dst != NULL && src != NULL && "Arguments passed shouldn't be NULL");
assert(dst != NULL && src != NULL);
u64 length = strlen(src);
u64 to_copy = length <= dst->capacity ? length : dst->capacity;
@@ -193,7 +193,7 @@ void wapp_str8_copy_cstr_capped(Str8 *dst, const char *src) {
}
void wapp_str8_copy_str8_capped(Str8 *dst, Str8RO *src) {
assert(dst != NULL && src != NULL && "Arguments passed shouldn't be NULL");
assert(dst != NULL && src != NULL);
u64 to_copy = src->size <= dst->capacity ? src->size : dst->capacity;
@@ -203,7 +203,7 @@ void wapp_str8_copy_str8_capped(Str8 *dst, Str8RO *src) {
}
void wapp_str8_copy_to_cstr(char *dst, Str8RO *src, u64 dst_capacity) {
assert(dst != NULL && src != NULL && "Arguments passed shouldn't be NULL");
assert(dst != NULL && src != NULL);
u64 to_copy = src->size < dst_capacity ? src->size : dst_capacity - 1;
@@ -212,7 +212,7 @@ void wapp_str8_copy_to_cstr(char *dst, Str8RO *src, u64 dst_capacity) {
}
void wapp_str8_format(Str8 *dst, const char *format, ...) {
assert(dst != NULL && format != NULL && "Arguments passed shouldn't be NULL");
assert(dst != NULL && format != NULL);
va_list args1;
va_list args2;
@@ -274,7 +274,7 @@ i64 wapp_str8_rfind(Str8RO *str, Str8RO substr) {
}
Str8List *wapp_str8_split_with_max(const Allocator *allocator, Str8RO *str, Str8RO *delimiter, i64 max_splits) {
assert(allocator != NULL && str != NULL && delimiter != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL && delimiter != NULL);
Str8List *output = wapp_mem_allocator_alloc(allocator, sizeof(Str8List));
@@ -327,7 +327,7 @@ RETURN_STR8_SPLIT:
}
Str8List *wapp_str8_rsplit_with_max(const Allocator *allocator, Str8RO *str, Str8RO *delimiter, i64 max_splits) {
assert(allocator != NULL && str != NULL && delimiter != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && str != NULL && delimiter != NULL);
Str8List *output = wapp_mem_allocator_alloc(allocator, sizeof(Str8List));
@@ -377,7 +377,7 @@ RETURN_STR8_SPLIT:
}
Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *delimiter) {
assert(allocator != NULL && list != NULL && delimiter != NULL && "Arguments passed shouldn't be NULL");
assert(allocator != NULL && list != NULL && delimiter != NULL);
u64 capacity = wapp_str8_list_total_size(list) + (delimiter->size * (list->node_count - 1));
Str8 *output = wapp_str8_alloc_buf(allocator, capacity * 2);