BASE_UTILS_API void* MEM_alloc | ( | int | n_bytes | ) |
Allocates a block on n_bytes bytes of memory.
n_bytes | (I) number of bytes to be allocated. |
BASE_UTILS_API void* MEM_crealloc | ( | void * | ptr, | |
int | n_items, | |||
int | item_size | |||
) |
Reallocate memory for an array and copy existing data. Works like MEM_realloc but this one is for an array and initializes extra space with zeroes.
ptr | (I) Pointer to start of array to be reallocated. |
n_items | (I) New number of elements in the array. |
item_size | (I) New size, in bytes, for a single array element. |
BASE_UTILS_API void MEM_free | ( | void * | ptr | ) |
Frees the specified memory block. The input pointer is expected to be a valid pointer allocated via relevant MEM_ API. If ptr is NULL then no operation is performed.
ptr | (I) Pointer to the block to be freed. |
BASE_UTILS_API void* MEM_realloc | ( | void * | ptr, | |
int | n_bytes | |||
) |
Reallocate memory and copy existing contents. Allocates a new memory block of input size and copies contents of existing memory block. Contents of extra memory in new block are undefined.
If the input pointer is NULL, normal allocation is done. If n_bytes is zero, existing storage is freed and NULL is returned. If n_bytes is less than current size of the memory block, the first n_bytes are copied.
ptr | (I) Pointer to a memory block to be reallocated. |
n_bytes | (I) Number of bytes to be allocated to the new block. |
BASE_UTILS_API char* MEM_string_copy | ( | const char * | str | ) |
Make a copy of a NULL terminated string.
str | (I) NULL terminated string to be copied. |