|
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. | |
| typedef void(* | mjrpc_error_log_func) (const char *message, int error_code) |
| Function pointer type for error logging callback. | |
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. | |
| int | mjrpc_set_error_log_hook (mjrpc_error_log_func error_log_func) |
| Set custom error logging function. | |
Custom memory management function hooks.
| mjrpc_error_log_func |
Function pointer type for error logging callback.
| message | Error message string |
| error_code | Optional error code (0 if not applicable) |
Definition at line 238 of file mjsonrpc.h.
| mjrpc_free_func |
Function pointer type for custom memory deallocation.
| ptr | Pointer to memory to free (can be NULL) |
Definition at line 216 of file mjsonrpc.h.
| mjrpc_malloc_func |
Function pointer type for custom memory allocation.
| size | Number of bytes to allocate |
Definition at line 206 of file mjsonrpc.h.
| mjrpc_strdup_func |
Function pointer type for custom string duplication.
| str | String to duplicate |
Definition at line 227 of file mjsonrpc.h.
| int mjrpc_set_error_log_hook | ( | mjrpc_error_log_func | error_log_func | ) |
Set custom error logging function.
This function allows users to set a callback function that will be called when errors occur within the mjsonrpc library. This enables integration with application logging systems for debugging and monitoring.
| error_log_func | Custom error logging callback function |
| 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) |