2018-10-10 05:53:07 -04:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-26 11:42:12 -04:00
|
|
|
#include "Compiler.h"
|
|
|
|
|
2018-10-22 08:06:22 -04:00
|
|
|
#ifdef SERENITY
|
2018-10-28 04:36:21 -04:00
|
|
|
#ifdef KERNEL
|
2018-10-17 04:55:43 -04:00
|
|
|
#include <Kernel/kmalloc.h>
|
2018-10-28 04:36:21 -04:00
|
|
|
#else
|
|
|
|
#include <LibC/stdlib.h>
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
void* kcalloc(size_t nmemb, size_t size);
|
|
|
|
void* kmalloc(size_t size) MALLOC_ATTR;
|
|
|
|
void kfree(void* ptr);
|
|
|
|
void* krealloc(void* ptr, size_t size);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void* operator new(size_t size)
|
|
|
|
{
|
|
|
|
return kmalloc(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
return kfree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void operator delete(void* ptr, size_t)
|
|
|
|
{
|
|
|
|
return kfree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void operator delete[](void* ptr, size_t)
|
|
|
|
{
|
|
|
|
return kfree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void* operator new(size_t, void* p) { return p; }
|
|
|
|
inline void* operator new[](size_t, void* p) { return p; }
|
2018-10-25 04:00:37 -04:00
|
|
|
#endif
|
2018-10-17 04:55:43 -04:00
|
|
|
#else
|
|
|
|
#include <new>
|
|
|
|
|
2018-10-10 05:53:07 -04:00
|
|
|
#include "Types.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
2018-10-16 07:59:28 -04:00
|
|
|
void* kcalloc(size_t nmemb, size_t size);
|
2018-10-25 04:00:37 -04:00
|
|
|
void* kmalloc(size_t size) MALLOC_ATTR;
|
2018-10-10 05:53:07 -04:00
|
|
|
void kfree(void* ptr);
|
2018-10-16 07:59:28 -04:00
|
|
|
void* krealloc(void* ptr, size_t size);
|
2018-10-10 05:53:07 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-10-17 04:55:43 -04:00
|
|
|
#endif
|
|
|
|
|