S2OPC OPCUA Toolkit
|
S2OPC memory allocation wrappers. More...
#include <stddef.h>
Go to the source code of this file.
Functions | |
void * | SOPC_Malloc (size_t size) |
Allocates memory. | |
void | SOPC_Free (void *ptr) |
Frees memory. | |
void * | SOPC_Calloc (size_t nmemb, size_t size) |
Allocates memory. | |
void * | SOPC_Realloc (void *ptr, size_t old_size, size_t new_size) |
Re-allocates memory. | |
S2OPC memory allocation wrappers.
void * SOPC_Malloc | ( | size_t | size | ) |
Allocates memory.
This function acts as standard 'malloc' except that it ensures that a non-NULL pointer is returned even if the requested size is zero
size | The amount of memory requested. |
void SOPC_Free | ( | void * | ptr | ) |
Frees memory.
This function acts as standard 'free'.
ptr | The previoulsy allocated pointer. Nothing is done if ptr is NULL. The caller shall ensure that the same pointer is not freed several times, and that only pointers previously allocated by SOPC_xalloc are passed as parameter. |
void * SOPC_Calloc | ( | size_t | nmemb, |
size_t | size ) |
Allocates memory.
This function acts as standard 'calloc'. However, if size is passed with the value "0", a non-null pointer shall be returned.
size | The size of each element allocated |
nmemb | The number of adjacent element requested. |
void * SOPC_Realloc | ( | void * | ptr, |
size_t | old_size, | ||
size_t | new_size ) |
Re-allocates memory.
This function acts as realloc. However, realloc may not exist on the targetted architecture. In these cases, SOPC_Realloc maps to malloc + memcpy. For this operation, the current size of the buffer is required.