forked from Bananymous/banan-os
BAN: Move RefPtr to its own file and create New.h
New.h contains definitions for placement new operators and BAN::allocator and BAN::dealloctor
This commit is contained in:
parent
c660df14ec
commit
2fabe1949c
|
@ -1,9 +0,0 @@
|
||||||
#include <BAN/Memory.h>
|
|
||||||
|
|
||||||
void* operator new(size_t size) { return BAN::allocator(size); }
|
|
||||||
void* operator new[](size_t size) { return BAN::allocator(size); }
|
|
||||||
|
|
||||||
void operator delete(void* addr) { BAN::deallocator(addr); }
|
|
||||||
void operator delete[](void* addr) { BAN::deallocator(addr); }
|
|
||||||
void operator delete(void* addr, size_t) { BAN::deallocator(addr); }
|
|
||||||
void operator delete[](void* addr, size_t) { BAN::deallocator(addr); }
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include <BAN/New.h>
|
||||||
|
|
||||||
|
void* operator new(size_t size) { return BAN::allocator(size); }
|
||||||
|
void* operator new[](size_t size) { return BAN::allocator(size); }
|
||||||
|
|
||||||
|
void operator delete(void* addr) { BAN::deallocator(addr); }
|
||||||
|
void operator delete[](void* addr) { BAN::deallocator(addr); }
|
||||||
|
void operator delete(void* addr, size_t) { BAN::deallocator(addr); }
|
||||||
|
void operator delete[](void* addr, size_t) { BAN::deallocator(addr); }
|
|
@ -1,7 +1,7 @@
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Math.h>
|
#include <BAN/Math.h>
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
|
#include <BAN/New.h>
|
||||||
#include <BAN/String.h>
|
#include <BAN/String.h>
|
||||||
#include <BAN/StringView.h>
|
#include <BAN/StringView.h>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
#include <BAN/Memory.h>
|
#include <BAN/New.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
|
#include <BAN/New.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(__is_kernel)
|
||||||
|
#include <kernel/kmalloc.h>
|
||||||
|
#else
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace BAN
|
||||||
|
{
|
||||||
|
#if defined(__is_kernel)
|
||||||
|
static constexpr void*(&allocator)(size_t) = kmalloc;
|
||||||
|
static constexpr void(&deallocator)(void*) = kfree;
|
||||||
|
#else
|
||||||
|
static constexpr void*(&allocator)(size_t) = malloc;
|
||||||
|
static constexpr void(&deallocator)(void*) = free;
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -3,8 +3,8 @@
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Iterators.h>
|
#include <BAN/Iterators.h>
|
||||||
#include <BAN/Math.h>
|
#include <BAN/Math.h>
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
|
#include <BAN/New.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,27 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
#include <BAN/NoCopyMove.h>
|
#include <BAN/NoCopyMove.h>
|
||||||
|
|
||||||
#if defined(__is_kernel)
|
|
||||||
#include <kernel/kmalloc.h>
|
|
||||||
#else
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
{
|
{
|
||||||
#if defined(__is_kernel)
|
|
||||||
static constexpr void*(&allocator)(size_t) = kmalloc;
|
|
||||||
static constexpr void(&deallocator)(void*) = kfree;
|
|
||||||
#else
|
|
||||||
static constexpr void*(&allocator)(size_t) = malloc;
|
|
||||||
static constexpr void(&deallocator)(void*) = free;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class RefCounted
|
class RefCounted
|
|
@ -3,8 +3,8 @@
|
||||||
#include <BAN/Errors.h>
|
#include <BAN/Errors.h>
|
||||||
#include <BAN/Iterators.h>
|
#include <BAN/Iterators.h>
|
||||||
#include <BAN/Math.h>
|
#include <BAN/Math.h>
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <BAN/Move.h>
|
#include <BAN/Move.h>
|
||||||
|
#include <BAN/New.h>
|
||||||
#include <BAN/Span.h>
|
#include <BAN/Span.h>
|
||||||
|
|
||||||
namespace BAN
|
namespace BAN
|
||||||
|
|
|
@ -79,7 +79,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(BAN_SOURCES
|
set(BAN_SOURCES
|
||||||
../BAN/BAN/Memory.cpp
|
../BAN/BAN/New.cpp
|
||||||
../BAN/BAN/String.cpp
|
../BAN/BAN/String.cpp
|
||||||
../BAN/BAN/StringView.cpp
|
../BAN/BAN/StringView.cpp
|
||||||
../BAN/BAN/Time.cpp
|
../BAN/BAN/Time.cpp
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <kernel/FS/Inode.h>
|
#include <kernel/FS/Inode.h>
|
||||||
|
|
||||||
namespace Kernel
|
namespace Kernel
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <BAN/Memory.h>
|
#include <BAN/RefPtr.h>
|
||||||
#include <BAN/String.h>
|
#include <BAN/String.h>
|
||||||
#include <BAN/StringView.h>
|
#include <BAN/StringView.h>
|
||||||
#include <BAN/Vector.h>
|
#include <BAN/Vector.h>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <BAN/LinkedList.h>
|
#include <BAN/LinkedList.h>
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <kernel/Semaphore.h>
|
#include <kernel/Semaphore.h>
|
||||||
#include <kernel/Thread.h>
|
#include <kernel/Thread.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <BAN/Memory.h>
|
|
||||||
#include <BAN/NoCopyMove.h>
|
#include <BAN/NoCopyMove.h>
|
||||||
|
#include <BAN/RefPtr.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue