mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-12 16:10:48 +00:00

* 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.
29 lines
484 B
C++
29 lines
484 B
C++
#include "SimpleAllocator.h"
|
|
#include "assert.h"
|
|
#include "configuration.h"
|
|
|
|
SimpleAllocator::SimpleAllocator()
|
|
{
|
|
reset();
|
|
}
|
|
|
|
void *SimpleAllocator::alloc(size_t size)
|
|
{
|
|
assert(nextFree + size <= sizeof(bytes));
|
|
void *res = &bytes[nextFree];
|
|
nextFree += size;
|
|
LOG_DEBUG("Total simple allocs %u\n", nextFree);
|
|
|
|
return res;
|
|
}
|
|
|
|
void SimpleAllocator::reset()
|
|
{
|
|
nextFree = 0;
|
|
}
|
|
|
|
void *operator new(size_t size, SimpleAllocator &p)
|
|
{
|
|
return p.alloc(size);
|
|
}
|