Address some FIXME comments (#4435)

* Address some FIXME comments

These comments have since been addressed by more modern code.
Remove them to reduce the clutter in the codebase.

* Remove 'dumb idea' from SimpleAllocator

4 year old code that was set never to run can probably be safely
deleted.
This commit is contained in:
Tom Fifield
2024-08-11 20:06:38 +08:00
committed by GitHub
parent 8daebf80dd
commit cf392a4c20
3 changed files with 3 additions and 47 deletions

View File

@@ -26,41 +26,3 @@ void *operator new(size_t size, SimpleAllocator &p)
{
return p.alloc(size);
}
#if 0
// This was a dumb idea, turn off for now
SimpleAllocator *activeAllocator;
AllocatorScope::AllocatorScope(SimpleAllocator &a)
{
assert(!activeAllocator);
activeAllocator = &a;
}
AllocatorScope::~AllocatorScope()
{
assert(activeAllocator);
activeAllocator = NULL;
}
/// Global new/delete, uses a simple allocator if it is in scope
void *operator new(size_t sz) throw(std::bad_alloc)
{
void *mem = activeAllocator ? activeAllocator->alloc(sz) : malloc(sz);
if (mem)
return mem;
else
throw std::bad_alloc();
}
void operator delete(void *ptr) throw()
{
if (activeAllocator)
LOG_WARN("Leaking an active allocator object\n"); // We don't properly handle this yet
else
free(ptr);
}
#endif