CMR
1.3.0
|
#include "env_internal.h"
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
Macros | |
#define | STACK_SIZE(k) (FIRST_STACK_SIZE << k) |
Functions | |
CMR_ERROR | CMRcreateEnvironment (CMR **pcmr) |
Allocates and initializes a default CMR environment. More... | |
CMR_ERROR | CMRfreeEnvironment (CMR **pcmr) |
Frees a CMR environment. More... | |
CMR_ERROR | _CMRallocBlock (CMR *cmr, void **ptr, size_t size) |
Carries out the allocation for CMRallocBlock. More... | |
CMR_ERROR | _CMRfreeBlock (CMR *cmr, void **ptr, size_t size) |
Carries out the deallocation for CMRfreeBlock. More... | |
CMR_ERROR | _CMRallocBlockArray (CMR *cmr, void **ptr, size_t size, size_t length) |
Carries out the allocation for CMRallocBlockArray. More... | |
CMR_ERROR | _CMRreallocBlockArray (CMR *cmr, void **ptr, size_t size, size_t length) |
Carries out the reallocation for CMRreallocBlockArray. More... | |
CMR_ERROR | _CMRduplicateBlockArray (CMR *cmr, void **ptr, size_t size, size_t length, void *source) |
Carries out the duplication for CMRduplicateBlockArray. More... | |
CMR_ERROR | _CMRfreeBlockArray (CMR *cmr, void **ptr) |
CMR_ERROR | _CMRallocStack (CMR *cmr, void **ptr, size_t size) |
Carries out the allocation for CMRallocStack. More... | |
CMR_ERROR | _CMRfreeStack (CMR *cmr, void **ptr) |
Carries out the deallocation for CMRfreeStack. More... | |
void | CMRassertStackConsistency (CMR *cmr) |
Checks stack protection fields for corruption. More... | |
size_t | CMRgetStackUsage (CMR *cmr) |
void | CMRraiseErrorMessage (CMR *cmr, const char *format,...) |
char * | CMRgetErrorMessage (CMR *cmr) |
Returns the error message (or NULL if no error with a message occured). More... | |
void | CMRclearErrorMessage (CMR *cmr) |
Clears the error message. More... | |
char * | CMRconsistencyMessage (const char *format,...) |
Variables | |
static const size_t | FIRST_STACK_SIZE = 4096L |
static const int | INITIAL_MEM_STACKS = 16 |
static const int | PROTECTION = INT_MIN / 42 |
#define STACK_SIZE | ( | k | ) | (FIRST_STACK_SIZE << k) |
Carries out the allocation for CMRallocBlock.
Carries out the allocation for CMRallocBlockArray.
Carries out the allocation for CMRallocStack.
cmr | CMR environment. |
ptr | Pointer where the space shall be allocated. |
size | Space to allocate. |
CMR_ERROR _CMRduplicateBlockArray | ( | CMR * | cmr, |
void ** | ptr, | ||
size_t | size, | ||
size_t | length, | ||
void * | source | ||
) |
Carries out the duplication for CMRduplicateBlockArray.
Carries out the deallocation for CMRfreeBlock.
Carries out the deallocation for CMRfreeStack.
cmr | CMR environment. |
ptr | Pointer of space to be freed. |
Carries out the reallocation for CMRreallocBlockArray.
void CMRassertStackConsistency | ( | CMR * | cmr | ) |
Checks stack protection fields for corruption.
Useful for debugging memory errors.
cmr | CMR environment. |
char* CMRconsistencyMessage | ( | const char * | format, |
... | |||
) |
char* CMRgetErrorMessage | ( | CMR * | cmr | ) |
Returns the error message (or NULL
if no error with a message occured).
cmr | CMR environment. |
void CMRraiseErrorMessage | ( | CMR * | cmr, |
const char * | format, | ||
... | |||
) |
cmr | CMR environment. |
format | Format string in printf-style. |
... | Variadic arguments. |
|
static |
Size of the first stack.
|
static |
Initial number of allocated stacks.
|
static |
Protection bytes to detect corruption.