2018-12-25 19:38:44 +08:00
|
|
|
#include <new>
|
2023-05-19 03:23:43 -07:00
|
|
|
#include <cstdlib>
|
2018-12-25 19:38:44 +08:00
|
|
|
|
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); }
|