mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +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
Notes:
sideshowbarker
2024-07-19 04:18:41 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/000ef0ec3d0
1 changed files with 46 additions and 1 deletions
47
AK/kmalloc.h
47
AK/kmalloc.h
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue