AK: Always include <new> from compiler before our operators new
We had competing inline definitions of the placement operators new. Avoid this by having <AK/kmalloc.h> pull in <new> from the compiler and always using their definitions instead. I feel like there must be an elegant solution to this whole situation with the operators, but I'm not sure what it is.
This commit is contained in:
parent
2cf8649d0e
commit
575c483310
Notes:
sideshowbarker
2024-07-19 01:33:01 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/575c4833104
1 changed files with 2 additions and 9 deletions
11
AK/kmalloc.h
11
AK/kmalloc.h
|
@ -52,6 +52,8 @@
|
|||
|
||||
# ifdef __serenity__
|
||||
|
||||
# include <new>
|
||||
|
||||
inline void* operator new(size_t size)
|
||||
{
|
||||
return kmalloc(size);
|
||||
|
@ -82,15 +84,6 @@ 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…
Add table
Reference in a new issue