Farm process memory and utility functions. More...
Functions | |
HqBool | rf_set_alloc_funcs (rf_alloc_t alloc_fn, rf_free_t free_fn) |
Set the allocation and deallocation functions for the library to use. If this function is not called the system will default to using malloc and free. More... | |
void * | rf_mem_alloc (size_t size) |
Allocate memory through the library allocation functions set by rf_set_alloc_funcs(). More... | |
void | rf_mem_free (void *ptr) |
Free memory allocated by the library. More... | |
char * | rf_strndup (const char *str, size_t len) |
Duplicate a string of a specified length into a memory allocated using rf_mem_alloc(). More... | |
char * | rf_strdup (const char *str) |
Duplicate a zero-terminated string into a memory allocated using rf_mem_alloc(). More... | |
void | rf_zsys_shutdown () |
Shut down ZeroMQ messaging before process exit. More... | |
Farm process memory and utility functions.
Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved. Global Graphics Software Ltd. Confidential Information.
void* rf_mem_alloc | ( | size_t | size | ) |
Allocate memory through the library allocation functions set by rf_set_alloc_funcs().
[in] | size | The size in bytes of the memory to allocate. |
NULL
pointer capable of storing size bytes, or NULL
if the memory could not be allocated. void rf_mem_free | ( | void * | ptr | ) |
Free memory allocated by the library.
ptr | An object allocated by the library. It is safe to call this function with a NULL ptr value. |
HqBool rf_set_alloc_funcs | ( | rf_alloc_t | alloc_fn, |
rf_free_t | free_fn | ||
) |
Set the allocation and deallocation functions for the library to use. If this function is not called the system will default to using malloc and free.
[in] | alloc_fn | Function to allocate memory. |
[in] | free_fn | Function to free allocated memory. |
TRUE | The allocation functions were set as requested. |
FALSE | The allocation functions were already set, and have not been changed. |
char* rf_strdup | ( | const char * | str | ) |
Duplicate a zero-terminated string into a memory allocated using rf_mem_alloc().
[in] | str | A non-NULL zero-terminated string to duplicate. |
NULL
if the memory could not be allocated. If non-NULL
, the returned string must be freed by the caller using rf_mem_free(). char* rf_strndup | ( | const char * | str, |
size_t | len | ||
) |
Duplicate a string of a specified length into a memory allocated using rf_mem_alloc().
[in] | str | A non-NULL string to duplicate. |
[in] | len | The length of the string to duplicate. This may be zero. |
NULL
if the memory could not be allocated. If non-NULL
, the returned string must be freed by the caller using rf_mem_free(). void rf_zsys_shutdown | ( | ) |
Shut down ZeroMQ messaging before process exit.