2018-01-29 15:14:50 +00:00
|
|
|
// ascee_alloc.h
|
|
|
|
//
|
|
|
|
// Author: J.A. de Jong - ASCEE
|
|
|
|
//
|
|
|
|
// Description:
|
|
|
|
// memory allocation functions.
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#ifndef ASCEE_ALLOC_H
|
|
|
|
#define ASCEE_ALLOC_H
|
|
|
|
#include <malloc.h>
|
2018-02-12 19:44:07 +00:00
|
|
|
#include "ascee_tracer.h"
|
2018-01-29 15:14:50 +00:00
|
|
|
/**
|
|
|
|
* Reserved words for memory allocation. Can be changed to something
|
|
|
|
* else when required. For example for debugging purposes.
|
|
|
|
*/
|
2018-02-12 19:44:07 +00:00
|
|
|
static inline void* a_malloc(size_t nbytes) {
|
|
|
|
void* ptr = malloc(nbytes);
|
|
|
|
if(!ptr) {
|
|
|
|
FATAL("Memory allocation failed. Exiting");
|
|
|
|
}
|
|
|
|
return ptr;
|
|
|
|
}
|
2018-01-29 15:14:50 +00:00
|
|
|
#define a_free free
|
|
|
|
#define a_realloc realloc
|
|
|
|
|
|
|
|
#endif // ASCEE_ALLOC_H
|
|
|
|
//////////////////////////////////////////////////////////////////////
|