cJSON_port.c 351 B

1234567891011121314151617181920
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. #include <rtthread.h>
  5. #include "cJSON.h"
  6. int cJSON_hook_init(void)
  7. {
  8. cJSON_Hooks cJSON_hook;
  9. cJSON_hook.malloc_fn = (void *(*)(size_t sz))rt_malloc;
  10. cJSON_hook.free_fn = rt_free;
  11. cJSON_InitHooks(&cJSON_hook);
  12. return RT_EOK;
  13. }
  14. INIT_COMPONENT_EXPORT(cJSON_hook_init);