43 lines
696 B
C++
43 lines
696 B
C++
#include "new.hpp"
|
|
|
|
#include <stdlib.h>
|
|
|
|
[[nodiscard]] void *operator new(size_t size)
|
|
{
|
|
return malloc(size);
|
|
}
|
|
|
|
void operator delete(void *ptr) noexcept
|
|
{
|
|
free(ptr);
|
|
}
|
|
void operator delete(void *ptr, size_t) noexcept
|
|
{
|
|
free(ptr);
|
|
}
|
|
|
|
[[nodiscard]] void *operator new[](size_t size)
|
|
{
|
|
return malloc(size);
|
|
}
|
|
|
|
void operator delete[](void *ptr) noexcept
|
|
{
|
|
free(ptr);
|
|
}
|
|
void operator delete[](void *ptr, size_t) noexcept
|
|
{
|
|
free(ptr);
|
|
}
|
|
|
|
[[nodiscard]] void *operator new(size_t, void *ptr) noexcept
|
|
{
|
|
return ptr;
|
|
}
|
|
[[nodiscard]] void *operator new[](size_t, void *ptr) noexcept
|
|
{
|
|
return ptr;
|
|
}
|
|
void operator delete(void *, void *)noexcept {}
|
|
void operator delete[](void *, void *) noexcept {}
|