Implement the system dependend memory functions.
More...
#include <stdlib.h>
#include <string.h>
#include "stb_os.h"
#include "glue_debug.h"
#include "glue_memory.h"
Go to the source code of this file.
|
#define | MallocFunc STB_MemAlloc |
|
#define | FreeFunc STB_MemFree |
|
#define | MAX_BLK_STRS 0x80 /* 128 memory blocks */ |
|
#define | VTINY_BITS 2 |
|
#define | MIGIT_BITS 3 |
|
#define | SMALL_BITS 4 |
|
#define | MEDUM_BITS 5 |
|
#define | LARGE_BITS 6 |
|
#define | STR_DATA_SIZE(bz) (MAX_BLK_STRS << bz) |
|
#define | STR_BLCK_SIZE(bz) STR_DATA_SIZE(bz) + sizeof(S_STRINGS_BLOCK) |
|
#define | CONTROL_SIZE (MAX_BLK_STRS >> 3) |
|
#define | BlkStrFree(head, bz, data) |
|
#define | theMemSize size |
|
#define | BlkStrAlloc(bk, bz, ln) BlkStrAlloc(bk, bz) |
|
|
void | MHEG5freeMemFunc (void *what) |
| Free some memory allocated by a call to MHEG5getMemFunc. More...
|
|
void * | MHEG5getMemFunc (int size) |
| Allocate a block of memory from the free pool. This function should be called using the macro MHEG5getMem. This ensures that the callingFunction parameter is only passed in when MHEG5LOG is defined. More...
|
|
void | STR_Shutdown (void) |
|
void | STR_TidyUp (void) |
|
unsigned char * | STR_DataAlloc (unsigned int len) |
|
void | STR_DataFree (unsigned char *data, unsigned int len) |
|
void | MHG_DebugMemStats (int line) |
|
BOOLEAN | MH5GlueMemoryInitialise (void) |
|
void | MH5GlueMemoryTerminate (void) |
|
S_STRING | MH5GlueStringCopy (S_STRING source) |
|
S_STRING | MH5GlueStringConcat (S_STRING src1, S_STRING src2) |
|
S_STRING | MH5GlueStringAlloc (U32BIT size) |
|
S_STRING | MH5GlueStringCreate (U32BIT size, U8BIT *data) |
|
void | MH5GlueStringFree (S_STRING *pStr) |
|
Implement the system dependend memory functions.
- Date
- 05/02/2002
- Author
- R.Freeman
Definition in file glue_memory.c.
#define BlkStrFree |
( |
|
head, |
|
|
|
bz, |
|
|
|
data |
|
) |
| |
Value: do { \
unsigned
char *blk_data = (
unsigned char *)pBlk +
sizeof(
S_STRINGS_BLOCK); \
if (data >= blk_data \
&& data < blk_data + STR_DATA_SIZE(bz)) \
{ int tmp; \
tmp = (data - blk_data) >> bz; \
pBlk->control[tmp >> 3] &= (U8BIT) ~(1 << (tmp & 7)); \
break; \
} \
pBlk = pBlk->next; \
} while (pBlk != NULL); \
if (pBlk == NULL) {
TRACE(TERROR, (
"Not freed %x", data)) } \
}
Definition at line 52 of file glue_memory.c.
void MHEG5freeMemFunc |
( |
void * |
what | ) |
|
Free some memory allocated by a call to MHEG5getMemFunc.
- Parameters
-
what | Pointer to allocated memory. |
- Returns
- void
Definition at line 190 of file glue_memory.c.
void* MHEG5getMemFunc |
( |
int |
size | ) |
|
Allocate a block of memory from the free pool. This function should be called using the macro MHEG5getMem. This ensures that the callingFunction parameter is only passed in when MHEG5LOG is defined.
- Parameters
-
callingFunction | Pointer to the calling function (only when MHEG5LOG is defined). |
size | Size in bytes of the memory region to allocate. |
- Returns
- Pointer to allocated memory, or NULL if allocation fails.
Definition at line 291 of file glue_memory.c.