High Performance OPC UA Server SDK  1.2.0.193
memory

Wrapper for common memory operations. More...

Macros

#define ua_memset(s, c, n)   ua_p_memset(s, c, n)
 Fill the first n bytes of the memory area pointed to by s with the byte c. More...
 
#define ua_memmove(dest, src, n)   ua_p_memmove(dest, src, n)
 Copy n bytes from memory area src to memory area dest. More...
 
#define ua_memcpy(dest, src, n)   ua_p_memcpy(dest, src, n)
 Copy n bytes from the memory area src to dest. More...
 
#define ua_memcmp(s1, s2, n)   ua_p_memcmp(s1, s2, n)
 Compare the first n bytes of the memory areas s1 and s2. More...
 

Functions

void * ua_malloc (size_t size)
 Allocate memory. More...
 
void * ua_calloc (size_t nmemb, size_t size)
 Allocate memory for an array of elements. More...
 
void * ua_realloc (void *ptr, size_t size)
 Change the size of allocated memory. More...
 
void ua_free (void *ptr)
 Free allocated memory.
 
char * ua_strdup (const char *s)
 Duplicate a zero terminated string. More...
 
void * ua_mempcpy (void *dest, const void *src, size_t n)
 Copy n bytes from the memory area src to dest. More...
 

Detailed Description

Wrapper for common memory operations.

In case a platform doesn't support standard malloc or has an optimized version of memset it can be forwarded to the custom implementation.

Macro Definition Documentation

#define ua_memcmp (   s1,
  s2,
 
)    ua_p_memcmp(s1, s2, n)

Compare the first n bytes of the memory areas s1 and s2.

Returns
Zero if both memory areas are equal, a positive value if s1 is greater, a negative value if s2 is greater.
#define ua_memcpy (   dest,
  src,
 
)    ua_p_memcpy(dest, src, n)

Copy n bytes from the memory area src to dest.

The memory areas must not overlap.

Returns
dest.
#define ua_memmove (   dest,
  src,
 
)    ua_p_memmove(dest, src, n)

Copy n bytes from memory area src to memory area dest.

The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that does not overlap src or dest, and the bytes are then copied from the temporary array to dest.

#define ua_memset (   s,
  c,
 
)    ua_p_memset(s, c, n)

Fill the first n bytes of the memory area pointed to by s with the byte c.

Returns
s.

Function Documentation

void* ua_calloc ( size_t  nmemb,
size_t  size 
)

Allocate memory for an array of elements.

Parameters
nmembNumber of elements to allocate.
sizeSize of one element.
Returns
Pointer to allocated memory or NULL on failure.
void* ua_malloc ( size_t  size)

Allocate memory.

Parameters
sizeNumber of bytes to allocate.
Returns
Pointer to allocated memory or NULL on failure.
void* ua_mempcpy ( void *  dest,
const void *  src,
size_t  n 
)

Copy n bytes from the memory area src to dest.

The memory areas must not overlap.

Returns
Pointer to the byte after the last written byte of dest.
void* ua_realloc ( void *  ptr,
size_t  size 
)

Change the size of allocated memory.

Parameters
ptrPointer to previously allocated memory.
sizeNumber of bytes to change memory size to.
Returns
Pointer to the changed memory or NULL on failure.
char* ua_strdup ( const char *  s)

Duplicate a zero terminated string.

The memory for the duplicated is allocated with ua_malloc and must be freed with ua_free.

Parameters
sString to duplicate
Returns
Pointer to duplicated string or NULL on failure.