|
mjsonrpc 1.0
A lightweight JSON-RPC 2.0 message parser and generator based on cJSON
|
Custom memory management function hooks. More...
Typedefs | |
| typedef void *(* | mjrpc_malloc_func) (size_t size) |
| Function pointer type for custom memory allocation. | |
| typedef void(* | mjrpc_free_func) (void *ptr) |
| Function pointer type for custom memory deallocation. | |
| typedef char *(* | mjrpc_strdup_func) (const char *str) |
| Function pointer type for custom string duplication. | |
Functions | |
| int | mjrpc_set_memory_hooks (mjrpc_malloc_func malloc_func, mjrpc_free_func free_func, mjrpc_strdup_func strdup_func) |
| Set custom memory management functions. | |
Custom memory management function hooks.
| mjrpc_free_func |
Function pointer type for custom memory deallocation.
| ptr | Pointer to memory to free (can be NULL) |
Definition at line 215 of file mjsonrpc.h.
| mjrpc_malloc_func |
Function pointer type for custom memory allocation.
| size | Number of bytes to allocate |
Definition at line 205 of file mjsonrpc.h.
| mjrpc_strdup_func |
Function pointer type for custom string duplication.
| str | String to duplicate |
Definition at line 226 of file mjsonrpc.h.
| int mjrpc_set_memory_hooks | ( | mjrpc_malloc_func | malloc_func, |
| mjrpc_free_func | free_func, | ||
| mjrpc_strdup_func | strdup_func | ||
| ) |
Set custom memory management functions.
This function allows users to override the default memory management functions used by the mjsonrpc library. All parameters must be provided together, or pass NULL for all to reset to default standard library functions.
| malloc_func | Custom malloc function (required if not resetting) |
| free_func | Custom free function (required if not resetting) |
| strdup_func | Custom strdup function (required if not resetting) |