refactor/project/Bloat.cpp
Ed_ 231c893c6b Rework of project implementation
For include and multi-file support. I still need to debug it,
Test will be adjusted as well; I want to get all the files not just zpl refactored using a powershell script.

I dropped the idea of semantically identifiying macros. While it may be possible, I don't see the utility vs the regular idendentifier distinction.
I want to keep the refactoring as simple as possible, where it just takes one pass to go through a file without any context to other files.

So far the ignores behave as a good guard filter for unwanted refactors and the only true weak area was the includes (which should be aleviated with the coming support for it.
2023-03-17 02:09:19 -04:00

38 lines
708 B
C++

#define BLOAT_IMPL
#include "bloat.hpp"
namespace Memory
{
static zpl_arena Global_Arena {};
void setup()
{
zpl_arena_init_from_allocator( & Global_Arena, zpl_heap(), zpl_megabytes(2) );
if ( Global_Arena.total_size == 0 )
{
zpl_assert_crash( "Failed to reserve memory for Tests:: Global_Arena" );
}
}
void resize( uw new_size )
{
void* new_memory = zpl_resize( zpl_heap(), Global_Arena.physical_start, Global_Arena.total_size, new_size );
if ( new_memory == nullptr )
{
fatal("Failed to resize global arena!");
}
Global_Arena.physical_start = new_memory;
Global_Arena.total_size = new_size;
}
void cleanup()
{
zpl_arena_free( & Global_Arena);
}
}