1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include <stdlib.h>
- #include "cJSON.h"
- #include "cJSON_iot_hooks.h"
- #include "sdk_config.h"
- #include "mem_manager.h"
- static cJSON_Hooks m_iot_hooks;
- static void * malloc_fn_hook(size_t sz)
- {
- return nrf_malloc(sz);
- }
- static void free_fn_hook(void * p_ptr)
- {
- nrf_free((uint8_t * ) p_ptr);
- }
- void cJSON_Init(void)
- {
- m_iot_hooks.malloc_fn = malloc_fn_hook;
- m_iot_hooks.free_fn = free_fn_hook;
- cJSON_InitHooks(&m_iot_hooks);
- }
|