#include <stdio.h>
#include <stdbool.h>
#include <stdarg.h>
#include <cmr/env.h>
Go to the source code of this file.
|
#define | CMRallocStack(cmr, ptr) _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr)) |
| Allocates statck memory for *ptr . More...
|
|
#define | CMRfreeStack(cmr, ptr) _CMRfreeStack(cmr, (void**) ptr, sizeof(**ptr)) |
| Frees a stack memory chunk allocated with CMRallocStack. More...
|
|
#define | CMRallocStackArray(cmr, ptr, length) _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr) * (length)) |
| Allocates memory for an array of blocks on the stack. More...
|
|
#define | CMRfreeStackArray(cmr, ptr) _CMRfreeStack(cmr, (void**) ptr) |
| Frees memory of an array of blocks on the stack. More...
|
|
#define | CMRdbgConsistencyAssert(call) |
|
◆ CMRallocStack
#define CMRallocStack |
( |
|
cmr, |
|
|
|
ptr |
|
) |
| _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr)) |
Allocates statck memory for *ptr
.
Stack memory shall be freed with CMRfreeStack in the reverse order of allocation. The size is determined automatically.
◆ CMRallocStackArray
#define CMRallocStackArray |
( |
|
cmr, |
|
|
|
ptr, |
|
|
|
length |
|
) |
| _CMRallocStack(cmr, (void**) ptr, sizeof(**ptr) * (length)) |
Allocates memory for an array of blocks on the stack.
◆ CMRdbgConsistencyAssert
#define CMRdbgConsistencyAssert |
( |
|
call | ) |
|
◆ CMRfreeStack
#define CMRfreeStack |
( |
|
cmr, |
|
|
|
ptr |
|
) |
| _CMRfreeStack(cmr, (void**) ptr, sizeof(**ptr)) |
◆ CMRfreeStackArray
#define CMRfreeStackArray |
( |
|
cmr, |
|
|
|
ptr |
|
) |
| _CMRfreeStack(cmr, (void**) ptr) |
Frees memory of an array of blocks on the stack.
◆ _CMRallocStack()
CMR_EXPORT CMR_ERROR _CMRallocStack |
( |
CMR * |
cmr, |
|
|
void ** |
ptr, |
|
|
size_t |
size |
|
) |
| |
Carries out the allocation for CMRallocStack.
- Note
- Use CMRallocStack to allocate stack memory.
- Parameters
-
cmr | CMR environment. |
ptr | Pointer where the space shall be allocated. |
size | Space to allocate. |
◆ _CMRfreeStack()
CMR_EXPORT CMR_ERROR _CMRfreeStack |
( |
CMR * |
cmr, |
|
|
void ** |
ptr |
|
) |
| |
Carries out the deallocation for CMRfreeStack.
- Note
- Use CMRfreeStack to free stack memory.
- Parameters
-
cmr | CMR environment. |
ptr | Pointer of space to be freed. |
◆ CMRassertStackConsistency()
void CMRassertStackConsistency |
( |
CMR * |
cmr | ) |
|
Checks stack protection fields for corruption.
Useful for debugging memory errors.
- Parameters
-
◆ CMRconsistencyMessage()
char* CMRconsistencyMessage |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
◆ CMRdbgMsg()
static void CMRdbgMsg |
( |
int |
indent, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
|
inlinestatic |
◆ CMRgetStackUsage()
size_t CMRgetStackUsage |
( |
CMR * |
cmr | ) |
|
◆ CMRraiseErrorMessage()
void CMRraiseErrorMessage |
( |
CMR * |
cmr, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
- Parameters
-
cmr | CMR environment. |
format | Format string in printf-style. |
... | Variadic arguments. |