Reorganise memory utilities

This commit is contained in:
2025-02-24 00:21:14 +00:00
parent 6119cf5c5f
commit 4520f2269d
17 changed files with 104 additions and 82 deletions

29
src/os/mem/mem_os.c Normal file
View File

@@ -0,0 +1,29 @@
#include "mem_os.h"
#include "mem_os_ops.h"
#include "aliases.h"
#include "platform.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#if defined(WAPP_PLATFORM_WINDOWS)
#include "mem_os_win.h"
#elif defined(WAPP_PLATFORM_POSIX)
#include "mem_os_posix.h"
#else
#error "Unrecognised platform"
#endif
void *wapp_mem_util_alloc(void *addr, u64 size, MemAccess access, MemAllocFlags flags, MemInitType type) {
void *output = mem_util_allocate(addr, size, access, flags, type);
if (type == WAPP_MEM_INIT_INITIALISED) {
memset(output, 0, size);
}
return output;
}
void wapp_mem_util_free(void *ptr, u64 size) {
mem_util_free(ptr, size);
}