Revert "AK: Let the compiler provide the default new and delete operators"

This reverts commit 45b05e9734.

I forgot about the Toolchain build again. :^(
This commit is contained in:
Andreas Kling 2020-08-04 21:15:45 +02:00
parent 90dcab381a
commit 000ef0ec3d
Notes: sideshowbarker 2024-07-19 04:18:41 +09:00

View file

@ -26,7 +26,7 @@
#pragma once
#if !defined(__serenity__) || !defined(KERNEL)
#ifndef __serenity__
# include <new>
#endif
@ -44,8 +44,53 @@
# include <Kernel/Heap/kmalloc.h>
#else
# include <stdlib.h>
# define kcalloc calloc
# define kmalloc malloc
# define kfree free
# define krealloc realloc
# ifdef __serenity__
inline void* operator new(size_t size)
{
return kmalloc(size);
}
inline void operator delete(void* ptr)
{
return kfree(ptr);
}
inline void operator delete(void* ptr, size_t)
{
return kfree(ptr);
}
inline void* operator new[](size_t size)
{
return kmalloc(size);
}
inline void operator delete[](void* ptr)
{
return kfree(ptr);
}
inline void operator delete[](void* ptr, size_t)
{
return kfree(ptr);
}
inline void* operator new(size_t, void* ptr)
{
return ptr;
}
inline void* operator new[](size_t, void* ptr)
{
return ptr;
}
# endif
#endif