diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-27 00:32:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 01:32:01 +0100 |
commit | f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287 (patch) | |
tree | 90f2c6a4885dbd181799e2325cf33588697674e1 /NorthstarDLL/core/memalloc.h | |
parent | bb8ed59f6891b1196c5f5bbe7346cd171c8215fa (diff) | |
download | NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.tar.gz NorthstarLauncher-f5ab6fb5e8be7b73e6003d4145081d5e0c0ce287.zip |
Folder restructuring from primedev (#624)v1.21.2-rc3v1.21.2
Copies of over the primedev folder structure for easier cherry-picking of further changes
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'NorthstarDLL/core/memalloc.h')
-rw-r--r-- | NorthstarDLL/core/memalloc.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/NorthstarDLL/core/memalloc.h b/NorthstarDLL/core/memalloc.h deleted file mode 100644 index 2f383335..00000000 --- a/NorthstarDLL/core/memalloc.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include "rapidjson/document.h" -// #include "include/rapidjson/allocators.h" - -extern "C" void* _malloc_base(size_t size); -extern "C" void* _calloc_base(size_t const count, size_t const size); -extern "C" void* _realloc_base(void* block, size_t size); -extern "C" void* _recalloc_base(void* const block, size_t const count, size_t const size); -extern "C" void _free_base(void* const block); -extern "C" char* _strdup_base(const char* src); - -void* operator new(size_t n); -void operator delete(void* p) noexcept; - -// void* malloc(size_t n); - -class SourceAllocator -{ -public: - static const bool kNeedFree = true; - void* Malloc(size_t size) - { - if (size) // behavior of malloc(0) is implementation defined. - return _malloc_base(size); - else - return NULL; // standardize to returning NULL. - } - void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) - { - (void)originalSize; - if (newSize == 0) - { - _free_base(originalPtr); - return NULL; - } - return _realloc_base(originalPtr, newSize); - } - static void Free(void* ptr) - { - _free_base(ptr); - } -}; - -typedef rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<SourceAllocator>, SourceAllocator> rapidjson_document; -// typedef rapidjson::GenericDocument<rapidjson::UTF8<>, SourceAllocator, SourceAllocator> rapidjson_document; -// typedef rapidjson::Document rapidjson_document; -// using MyDocument = rapidjson::GenericDocument<rapidjson::UTF8<>, MemoryAllocator>; -// using rapidjson_document = rapidjson::GenericDocument<rapidjson::UTF8<>, SourceAllocator, SourceAllocator>; |