forked from Bananymous/banan-os
BAN: implement placement new
This commit is contained in:
parent
61de71e0d5
commit
82a25f9035
|
@ -1,13 +0,0 @@
|
||||||
#include <BAN/Memory.h>
|
|
||||||
|
|
||||||
namespace std { enum class align_val_t : size_t {}; }
|
|
||||||
|
|
||||||
void* operator new(size_t size) { return BAN::allocator(size); }
|
|
||||||
void* operator new[](size_t size) { return BAN::allocator(size); }
|
|
||||||
void* operator new(size_t size, std::align_val_t al) { return BAN::allocator_align(size, (size_t)al); }
|
|
||||||
void* operator new[](size_t size, std::align_val_t al) { return BAN::allocator_align(size, (size_t)al); }
|
|
||||||
|
|
||||||
void operator delete(void* addr) { BAN::deallocator(addr); }
|
|
||||||
void operator delete[](void* addr) { BAN::deallocator(addr); }
|
|
||||||
void operator delete(void* addr, size_t) { BAN::deallocator(addr); }
|
|
||||||
void operator delete[](void* addr, size_t) { BAN::deallocator(addr); }
|
|
|
@ -33,7 +33,6 @@ FREEOBJS= \
|
||||||
$(ARCH_FREEOBJS) \
|
$(ARCH_FREEOBJS) \
|
||||||
BAN/String.o \
|
BAN/String.o \
|
||||||
BAN/StringView.o \
|
BAN/StringView.o \
|
||||||
BAN/Memory.o \
|
|
||||||
|
|
||||||
HOSTEDOBJS=\
|
HOSTEDOBJS=\
|
||||||
$(ARCH_HOSTEDOBJS) \
|
$(ARCH_HOSTEDOBJS) \
|
||||||
|
|
|
@ -37,3 +37,17 @@ namespace BAN
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace std { enum class align_val_t : size_t {}; }
|
||||||
|
|
||||||
|
inline void* operator new(size_t size) { return BAN::allocator(size); }
|
||||||
|
inline void* operator new[](size_t size) { return BAN::allocator(size); }
|
||||||
|
inline void* operator new(size_t size, std::align_val_t align) { return BAN::allocator_align(size, (size_t)align); }
|
||||||
|
inline void* operator new[](size_t size, std::align_val_t align) { return BAN::allocator_align(size, (size_t)align); }
|
||||||
|
inline void* operator new(size_t, void* addr) { return addr; }
|
||||||
|
inline void* operator new[](size_t, void* addr) { return addr; }
|
||||||
|
|
||||||
|
inline void operator delete(void* addr) { BAN::deallocator(addr); }
|
||||||
|
inline void operator delete[](void* addr) { BAN::deallocator(addr); }
|
||||||
|
inline void operator delete(void* addr, size_t) { BAN::deallocator(addr); }
|
||||||
|
inline void operator delete[](void* addr, size_t) { BAN::deallocator(addr); }
|
||||||
|
|
Loading…
Reference in New Issue