Rename arena

This commit is contained in:
2026-06-26 17:17:22 +01:00
parent f0e9da26bd
commit 273dbf4535
12 changed files with 224 additions and 224 deletions
+8 -8
View File
@@ -10,7 +10,7 @@ wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
wp_intern WpAllocator temp_allocator = {0};
WpTestFuncResult test_arena_allocator(void) {
WpAllocator allocator = wapp_mem_arena_allocator_init(4096);
WpAllocator allocator = wpMemArenaAllocatorInit(4096);
b8 result = allocator.obj != NULL && allocator.alloc != NULL &&
allocator.alloc_aligned != NULL &&
allocator.realloc != NULL && allocator.realloc_aligned != NULL &&
@@ -18,7 +18,7 @@ WpTestFuncResult test_arena_allocator(void) {
void *ptr = wpMemAllocatorAlloc(&allocator, 20);
result = result && (ptr != NULL);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
@@ -26,7 +26,7 @@ WpTestFuncResult test_arena_allocator(void) {
WpTestFuncResult test_arena_allocator_with_buffer(void) {
u8 buffer[KiB(4)] = {0};
WpAllocator allocator = wapp_mem_arena_allocator_init_with_buffer(buffer, KiB(4));
WpAllocator allocator = wpMemArenaAllocatorInitWithBuffer(buffer, KiB(4));
b8 result = allocator.obj != NULL && allocator.alloc != NULL &&
allocator.alloc_aligned != NULL &&
allocator.realloc != NULL && allocator.realloc_aligned != NULL &&
@@ -34,18 +34,18 @@ WpTestFuncResult test_arena_allocator_with_buffer(void) {
void *ptr = wpMemAllocatorAlloc(&allocator, 20);
result = result && (ptr != NULL);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_arena_allocator_temp_begin(void) {
temp_allocator = wapp_mem_arena_allocator_init_with_buffer(temp_buf, TEMP_BUF_SIZE);
temp_allocator = wpMemArenaAllocatorInitWithBuffer(temp_buf, TEMP_BUF_SIZE);
i32 *num1 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
b8 result = num1 != NULL;
wapp_mem_arena_allocator_temp_begin(&temp_allocator);
wpMemArenaAllocatorTempBegin(&temp_allocator);
i32 *num2 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
result = result && num2 != NULL;
i32 *num3 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
@@ -55,13 +55,13 @@ WpTestFuncResult test_arena_allocator_temp_begin(void) {
}
WpTestFuncResult test_arena_allocator_temp_end(void) {
wapp_mem_arena_allocator_temp_end(&temp_allocator);
wpMemArenaAllocatorTempEnd(&temp_allocator);
i32 *num1 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
b8 result = num1 != NULL;
i32 *num2 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
result = result && num2 == NULL;
wapp_mem_arena_allocator_destroy(&temp_allocator);
wpMemArenaAllocatorDestroy(&temp_allocator);
return wpTesterResult(result);
}
+8 -8
View File
@@ -10,7 +10,7 @@ wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
wp_intern WpAllocator temp_allocator = {};
WpTestFuncResult test_arena_allocator(void) {
WpAllocator allocator = wapp_mem_arena_allocator_init(4096);
WpAllocator allocator = wpMemArenaAllocatorInit(4096);
b8 result = allocator.obj != nullptr && allocator.alloc != nullptr &&
allocator.alloc_aligned != nullptr &&
allocator.realloc != nullptr && allocator.realloc_aligned != nullptr &&
@@ -18,7 +18,7 @@ WpTestFuncResult test_arena_allocator(void) {
void *ptr = wpMemAllocatorAlloc(&allocator, 20);
result = result && (ptr != nullptr);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
@@ -26,7 +26,7 @@ WpTestFuncResult test_arena_allocator(void) {
WpTestFuncResult test_arena_allocator_with_buffer(void) {
u8 buffer[KiB(4)] = {0};
WpAllocator allocator = wapp_mem_arena_allocator_init_with_buffer(buffer, KiB(4));
WpAllocator allocator = wpMemArenaAllocatorInitWithBuffer(buffer, KiB(4));
b8 result = allocator.obj != NULL && allocator.alloc != NULL &&
allocator.alloc_aligned != NULL &&
allocator.realloc != NULL && allocator.realloc_aligned != NULL &&
@@ -34,18 +34,18 @@ WpTestFuncResult test_arena_allocator_with_buffer(void) {
void *ptr = wpMemAllocatorAlloc(&allocator, 20);
result = result && (ptr != NULL);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_arena_allocator_temp_begin(void) {
temp_allocator = wapp_mem_arena_allocator_init_with_buffer(temp_buf, TEMP_BUF_SIZE);
temp_allocator = wpMemArenaAllocatorInitWithBuffer(temp_buf, TEMP_BUF_SIZE);
i32 *num1 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
b8 result = num1 != NULL;
wapp_mem_arena_allocator_temp_begin(&temp_allocator);
wpMemArenaAllocatorTempBegin(&temp_allocator);
i32 *num2 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
result = result && num2 != NULL;
i32 *num3 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
@@ -55,13 +55,13 @@ WpTestFuncResult test_arena_allocator_temp_begin(void) {
}
WpTestFuncResult test_arena_allocator_temp_end(void) {
wapp_mem_arena_allocator_temp_end(&temp_allocator);
wpMemArenaAllocatorTempEnd(&temp_allocator);
i32 *num1 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
b8 result = num1 != NULL;
i32 *num2 = (i32 *)wpMemAllocatorAlloc(&temp_allocator, sizeof(i32));
result = result && num2 == NULL;
wapp_mem_arena_allocator_destroy(&temp_allocator);
wpMemArenaAllocatorDestroy(&temp_allocator);
return wpTesterResult(result);
}