mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
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:
parent
90dcab381a
commit
000ef0ec3d
1 changed files with 46 additions and 1 deletions
47
AK/kmalloc.h
47
AK/kmalloc.h
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if !defined(__serenity__) || !defined(KERNEL)
|
#ifndef __serenity__
|
||||||
# include <new>
|
# include <new>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -44,8 +44,53 @@
|
||||||
# include <Kernel/Heap/kmalloc.h>
|
# include <Kernel/Heap/kmalloc.h>
|
||||||
#else
|
#else
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
||||||
# define kcalloc calloc
|
# define kcalloc calloc
|
||||||
# define kmalloc malloc
|
# define kmalloc malloc
|
||||||
# define kfree free
|
# define kfree free
|
||||||
# define krealloc realloc
|
# 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
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue