#include <libcmutils.h>
|
| void *(* | Alloc )(size_t size) |
| | Allocate memory.
|
| |
| void *(* | Calloc )(size_t nmem, size_t size) |
| | Allocate memory with zero filled.
|
| |
| void *(* | Realloc )(void *ptr, size_t size) |
| | Reallocate memory.
|
| |
| char *(* | Strdup )(const char *str) |
| | Duplicate a string.
|
| |
| void(* | Free )(void *ptr) |
| | Free memory.
|
| |
Memory operation interface.
◆ Alloc
| void *(* CMUTIL_Mem::Alloc) (size_t size) |
Allocate memory.
Allocates size bytes and returns a pointer to the allocated memory. The memory is not initialized. If size is 0, then this function returns either NULL or a unique pointer value that can later be successfully passed to Free.
- Parameters
-
| size | Count of bytes to be allocated. |
- Returns
- A pointer to the allocated memory, which is suitably aligned for any built-in type. On error this function returns NULL. NULL may also be returned by a successful call to this function with a
size of zero.
◆ Calloc
| void *(* CMUTIL_Mem::Calloc) (size_t nmem, size_t size) |
Allocate memory with zero filled.
- Parameters
-
| nmem | Count of memory elements to be allocated. |
| size | Size of each memory element. |
- Returns
- A pointer to the allocated memory, which is suitably aligned for any built-in type. On error this function returns NULL. NULL may also be returned by a successful call to this function with a
size of zero.
◆ Realloc
| void *(* CMUTIL_Mem::Realloc) (void *ptr, size_t size) |
Reallocate memory.
- Parameters
-
| ptr | Pointer to the memory block to be reallocated. |
| size | New size of the memory block. |
- Returns
- A pointer to the reallocated memory, which is suitably aligned for any built-in type. On error this function returns NULL. NULL may also be returned by a successful call to this function with a
size of zero.
◆ Strdup
| char *(* CMUTIL_Mem::Strdup) (const char *str) |
Duplicate a string.
- Parameters
-
| str | Pointer to the string to be duplicated. |
- Returns
- A pointer to the duplicated string, which is suitably aligned for any built-in type. On error this function returns NULL. NULL may also be returned by a successful call to this function with a
str of NULL.
◆ Free
| void(* CMUTIL_Mem::Free) (void *ptr) |
Free memory.
- Parameters
-
| ptr | Pointer to the memory block to be freed. |
The documentation for this struct was generated from the following file: