mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-02 08:00:38 +00:00
Put a bit of order in the src directory, group and name things appropriately
This commit is contained in:
32
src/platform/nrf52/alloc.cpp
Normal file
32
src/platform/nrf52/alloc.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "configuration.h"
|
||||
#include "rtos.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Custom new/delete to panic if out out memory
|
||||
*/
|
||||
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
auto p = rtos_malloc(size);
|
||||
assert(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
auto p = rtos_malloc(size);
|
||||
assert(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void operator delete(void *ptr)
|
||||
{
|
||||
rtos_free(ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void *ptr)
|
||||
{
|
||||
rtos_free(ptr);
|
||||
}
|
||||
Reference in New Issue
Block a user