diff --git a/src/primitives/strings/str8/str8.c b/src/primitives/strings/str8/str8.c index 11c4f3d..76c1ddb 100644 --- a/src/primitives/strings/str8/str8.c +++ b/src/primitives/strings/str8/str8.c @@ -182,53 +182,6 @@ RETURN_STR8_CONCAT: return output; } -Str8 *wapp_str8_alloc_copy_cstr(const Allocator *allocator, Str8 *dst, const char *src) { - wapp_debug_assert(allocator != NULL && dst != NULL && src != NULL, "`allocator`, `dst` and `src` should not be NULL"); - - Str8 *output = NULL; - u64 size = strlen(src); - if (size <= dst->capacity) { - output = dst; - goto SOURCE_CSTRING_STR8_COPY; - } - - u64 capacity = dst->capacity + size; - - output = wapp_str8_alloc_buf(allocator, capacity); - if (!output) { - goto RETURN_CSTRING_STR8_COPY; - } - -SOURCE_CSTRING_STR8_COPY: - wapp_str8_copy_cstr_capped(output, src); - -RETURN_CSTRING_STR8_COPY: - return output; -} - -Str8 *wapp_str8_alloc_copy_str8(const Allocator *allocator, Str8 *dst, Str8RO *src) { - wapp_debug_assert(allocator != NULL && dst != NULL && src != NULL, "`allocator`, `dst` and `src` should not be NULL"); - - Str8 *output = NULL; - if (src->size <= dst->capacity) { - output = dst; - goto SOURCE_STRING_STR8_COPY; - } - - u64 capacity = dst->capacity + src->size; - - output = wapp_str8_alloc_buf(allocator, capacity); - if (!output) { - goto RETURN_STRING_STR8_COPY; - } - -SOURCE_STRING_STR8_COPY: - wapp_str8_copy_str8_capped(output, src); - -RETURN_STRING_STR8_COPY: - return output; -} - void wapp_str8_concat_capped(Str8 *dst, Str8RO *src) { wapp_debug_assert(dst != NULL && src != NULL, "`dst` and `src` should not be NULL"); diff --git a/src/primitives/strings/str8/str8.h b/src/primitives/strings/str8/str8.h index a134f6a..b74ffc8 100644 --- a/src/primitives/strings/str8/str8.h +++ b/src/primitives/strings/str8/str8.h @@ -79,8 +79,6 @@ Str8 *wapp_str8_alloc_cstr(const Allocator *allocator, const char *str); Str8 *wapp_str8_alloc_str8(const Allocator *allocator, Str8RO *str); Str8 *wapp_str8_alloc_substr(const Allocator *allocator, Str8RO *str, u64 start, u64 end); Str8 *wapp_str8_alloc_concat(const Allocator *allocator, Str8 *dst, Str8RO *src); -Str8 *wapp_str8_alloc_copy_cstr(const Allocator *allocator, Str8 *dst, const char *src); -Str8 *wapp_str8_alloc_copy_str8(const Allocator *allocator, Str8 *dst, Str8RO *src); // Only needed for allocators like malloc where each allocation has to be freed on its own. // No need to use it for allocators like Arena. void wapp_str8_dealloc_buf(const Allocator *allocator, Str8 **str);