2018-12-25 19:38:44 +08:00
|
|
|
#include <new>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2019-01-19 23:59:37 -05:00
|
|
|
/* Override libc++ new implementation
|
|
|
|
* to optimize final build size */
|
|
|
|
|
2018-12-25 19:38:44 +08:00
|
|
|
void* operator new(std::size_t s) { return malloc(s); }
|
|
|
|
void* operator new[](std::size_t s) { return malloc(s); }
|
|
|
|
void operator delete(void *p) { free(p); }
|
|
|
|
void operator delete[](void *p) { free(p); }
|
2019-01-20 00:07:58 -05:00
|
|
|
void* operator new(std::size_t s, const std::nothrow_t&) noexcept { return malloc(s); }
|
|
|
|
void* operator new[](std::size_t s, const std::nothrow_t&) noexcept { return malloc(s); }
|
|
|
|
void operator delete(void *p, const std::nothrow_t&) noexcept { free(p); }
|
|
|
|
void operator delete[](void *p, const std::nothrow_t&) noexcept { free(p); }
|