Magisk/native/src/base/new.cpp

15 lines
685 B
C++
Raw Normal View History

#include <new>
2023-05-19 03:23:43 -07:00
#include <cstdlib>
2019-01-19 23:59:37 -05:00
/* Override libc++ new implementation
* to optimize final build size */
2023-05-19 03:23:43 -07:00
void* operator new(std::size_t s) { return std::malloc(s); }
void* operator new[](std::size_t s) { return std::malloc(s); }
void operator delete(void *p) { std::free(p); }
void operator delete[](void *p) { std::free(p); }
void* operator new(std::size_t s, const std::nothrow_t&) noexcept { return std::malloc(s); }
void* operator new[](std::size_t s, const std::nothrow_t&) noexcept { return std::malloc(s); }
void operator delete(void *p, const std::nothrow_t&) noexcept { std::free(p); }
void operator delete[](void *p, const std::nothrow_t&) noexcept { std::free(p); }