// vim:fileencoding=utf-8:foldmethod=marker

#include "mem_os.h"
#include "mem_os_ops.h"
#include "../../common/aliases/aliases.h"
#include "../../common/platform/platform.h"
#include <assert.h>
#include <string.h>

#if defined(WAPP_PLATFORM_WINDOWS)
#include "win/mem_os_win.h"
#elif defined(WAPP_PLATFORM_POSIX)
#include "posix/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);
}
