From 99f7dcd7944fac2343e3521dcd6e67cc82e33d53 Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Tue, 18 Feb 2025 21:02:02 +0000 Subject: [PATCH] Rename wapp_str8_buf_alloc to wapp_str8_alloc_buf --- src/core/strings/str8/str8.c | 10 +++++----- src/core/strings/str8/str8.h | 2 +- tests/str8/test_str8.c | 4 ++-- tests/str8/test_str8.h | 2 +- tests/wapptest.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/strings/str8/str8.c b/src/core/strings/str8/str8.c index b25e382..00027fd 100644 --- a/src/core/strings/str8/str8.c +++ b/src/core/strings/str8/str8.c @@ -6,7 +6,7 @@ internal Str8List node_to_list(Str8Node *node); -Str8 *wapp_str8_buf_alloc(const Allocator *allocator, u64 capacity) { +Str8 *wapp_str8_alloc_buf(const Allocator *allocator, u64 capacity) { Str8 *str = NULL; if (!allocator) { @@ -40,7 +40,7 @@ Str8 *wapp_str8_alloc_cstr(const Allocator *allocator, const char *str) { } u64 length = strlen(str); - output = wapp_str8_buf_alloc(allocator, length * 2); + output = wapp_str8_alloc_buf(allocator, length * 2); if (!output) { goto RETURN_ALLOC_CSTR; } @@ -59,7 +59,7 @@ Str8 *wapp_str8_alloc_str8(const Allocator *allocator, Str8RO *str) { goto RETURN_ALLOC_STR8; } - output = wapp_str8_buf_alloc(allocator, str->capacity); + output = wapp_str8_alloc_buf(allocator, str->capacity); if (!output) { goto RETURN_ALLOC_STR8; } @@ -133,7 +133,7 @@ Str8 *wapp_str8_concat(const Allocator *allocator, Str8 *dst, Str8RO *src) { u64 capacity = dst->capacity + src->size; - output = wapp_str8_buf_alloc(allocator, capacity); + output = wapp_str8_alloc_buf(allocator, capacity); if (!output) { goto RETURN_STR8_CONCAT; } @@ -359,7 +359,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d } u64 capacity = list->total_size + (delimiter->size * (list->node_count - 1)); - Str8 *output = wapp_str8_buf_alloc(allocator, capacity * 2); + Str8 *output = wapp_str8_alloc_buf(allocator, capacity * 2); // NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of // MSVC Spectre mitigation warnings diff --git a/src/core/strings/str8/str8.h b/src/core/strings/str8/str8.h index bc88ed3..39480a4 100644 --- a/src/core/strings/str8/str8.h +++ b/src/core/strings/str8/str8.h @@ -57,7 +57,7 @@ struct str8_list { /** * Str8 allocated buffers */ -Str8 *wapp_str8_buf_alloc(const Allocator *allocator, u64 capacity); +Str8 *wapp_str8_alloc_buf(const Allocator *allocator, u64 capacity); Str8 *wapp_str8_alloc_cstr(const Allocator *allocator, const char *str); Str8 *wapp_str8_alloc_str8(const Allocator *allocator, Str8RO *str); diff --git a/tests/str8/test_str8.c b/tests/str8/test_str8.c index 71bc032..0a605a8 100644 --- a/tests/str8/test_str8.c +++ b/tests/str8/test_str8.c @@ -80,14 +80,14 @@ TestFuncResult test_str8_buf(void) { return wapp_tester_result(result); } -TestFuncResult test_str8_buf_alloc(void) { +TestFuncResult test_str8_alloc_buf(void) { bool result; Allocator allocator = wapp_mem_arena_allocator_init(MB(10)); if (wapp_mem_allocator_invalid(&allocator)) { return wapp_tester_result(false); } - Str8 *s = wapp_str8_buf_alloc(&allocator, 4096); + Str8 *s = wapp_str8_alloc_buf(&allocator, 4096); result = s != NULL && s->capacity == 4096; wapp_mem_arena_allocator_destroy(&allocator); diff --git a/tests/str8/test_str8.h b/tests/str8/test_str8.h index fc5f6fa..9febfcd 100644 --- a/tests/str8/test_str8.h +++ b/tests/str8/test_str8.h @@ -10,7 +10,7 @@ BEGIN_C_LINKAGE TestFuncResult test_str8_lit(void); TestFuncResult test_str8_lit_ro(void); TestFuncResult test_str8_buf(void); -TestFuncResult test_str8_buf_alloc(void); +TestFuncResult test_str8_alloc_buf(void); TestFuncResult test_str8_alloc_cstr(void); TestFuncResult test_str8_alloc_str8(void); TestFuncResult test_str8_get_index_within_bounds(void); diff --git a/tests/wapptest.c b/tests/wapptest.c index ca1a29f..1c5abd0 100644 --- a/tests/wapptest.c +++ b/tests/wapptest.c @@ -16,7 +16,7 @@ int main(void) { test_str8_lit, test_str8_lit_ro, test_str8_buf, - test_str8_buf_alloc, + test_str8_alloc_buf, test_str8_alloc_cstr, test_str8_alloc_str8, test_str8_get_index_within_bounds,