diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-03-25 19:32:02 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-03-25 19:32:02 +0100 |
commit | 5606b4c399404c0b8f745c6702d70f26eff8b371 (patch) | |
tree | aeafe10a9697196b101a457654319b73fb1c89a0 /deimos/core/api_registry.cpp | |
parent | 00c0d78199fcfbbb20828be5e06fd2d271fa4c1e (diff) |
Update to Clang 18, C++23, rework allocator
Diffstat (limited to 'deimos/core/api_registry.cpp')
-rw-r--r-- | deimos/core/api_registry.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/deimos/core/api_registry.cpp b/deimos/core/api_registry.cpp index aa993e0..a070473 100644 --- a/deimos/core/api_registry.cpp +++ b/deimos/core/api_registry.cpp @@ -1,6 +1,7 @@ #include "deimos/core/api_registry.h"
#include "deimos/core/allocator.h"
-#include "deimos/core/hash.h"
+
+static deimos::AllocatorApi* g_allocator_api;
namespace deimos
{
@@ -13,32 +14,36 @@ struct ApiEntry IdName name;
void* impl;
- ApiEntry(const IdName& name, void* impl) :
- name{name}, impl{impl}
+ ApiEntry(const IdName& name_, void* impl_) :
+ name{name_}, impl{impl_}
{}
};
class ApiRegistryImpl: public ApiRegistry
{
- IAllocator* m_allocator;
+ Allocator* m_allocator;
public:
- explicit ApiRegistryImpl(IAllocator* allocator) :
+ explicit ApiRegistryImpl(Allocator* allocator) :
m_allocator{allocator}
{}
void Set(const IdName& name, void* impl) final
{
+ (void)name;
+ (void)impl;
+ (void)m_allocator;
}
};
ApiRegistry* InitializeGlobalApiRegistry()
{
- AllocatorApi* allocator_api = BootstrapAllocatorApi();
- IAllocator* allocator = allocator_api->system;
- ApiRegistry* api_registry = allocator->New<ApiRegistryImpl>();
+ g_allocator_api = BootstrapAllocatorApi();
+
+ Allocator* allocator = g_allocator_api->system;
+ ApiRegistry* api_registry = allocator->New<ApiRegistryImpl>(allocator);
- api_registry->Set(allocator_api);
+ api_registry->Set(g_allocator_api);
return api_registry;
}
|