Magisk/native/jni/base/new.cpp

15 lines
646 B
C++
Raw Normal View History

#include <new>
#include <stdlib.h>
2019-01-20 04:59:37 +00:00
/* Override libc++ new implementation
* to optimize final build size */
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 05:07:58 +00: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); }