Lines Matching refs:hooks
149 static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) in cJSON_strdup() argument
160 copy = (unsigned char*)hooks->allocate(length); in cJSON_strdup()
170 CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) in cJSON_InitHooks() argument
172 if (hooks == NULL) in cJSON_InitHooks()
182 if (hooks->malloc_fn != NULL) in cJSON_InitHooks()
184 global_hooks.allocate = hooks->malloc_fn; in cJSON_InitHooks()
188 if (hooks->free_fn != NULL) in cJSON_InitHooks()
190 global_hooks.deallocate = hooks->free_fn; in cJSON_InitHooks()
202 static cJSON *cJSON_New_Item(const internal_hooks * const hooks) in cJSON_New_Item() argument
204 cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); in cJSON_New_Item()
254 internal_hooks hooks; member
369 internal_hooks hooks; member
423 if (p->hooks.reallocate != NULL) in ensure()
426 newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); in ensure()
429 p->hooks.deallocate(p->buffer); in ensure()
439 newbuffer = (unsigned char*)p->hooks.allocate(newsize); in ensure()
442 p->hooks.deallocate(p->buffer); in ensure()
452 p->hooks.deallocate(p->buffer); in ensure()
737 output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); in parse_string()
815 input_buffer->hooks.deallocate(output); in parse_string()
1017 buffer.hooks = global_hooks; in cJSON_ParseWithOpts()
1087 …signed char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) in print() argument
1096 buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); in print()
1099 buffer->hooks = *hooks; in print()
1113 if (hooks->reallocate != NULL) in print()
1115 printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); in print()
1123 printed = (unsigned char*) hooks->allocate(buffer->offset + 1); in print()
1132 hooks->deallocate(buffer->buffer); in print()
1140 hooks->deallocate(buffer->buffer); in print()
1145 hooks->deallocate(printed); in print()
1181 p.hooks = global_hooks; in cJSON_PrintBuffered()
1206 p.hooks = global_hooks; in cJSON_PrintPreallocated()
1379 cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); in parse_array()
1533 cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); in parse_object()
1823 static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) in create_reference() argument
1831 reference = cJSON_New_Item(hooks); in create_reference()
1895 …nst char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool … in add_item_to_object() argument
1912 new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); in add_item_to_object()
1923 hooks->deallocate(item->string); in add_item_to_object()