Lines Matching refs:hooks

171 static unsigned char *cJSON_strdup(const unsigned char *string, const internal_hooks *const hooks)  in cJSON_strdup()  argument
179 copy = (unsigned char *)hooks->allocate(length); in cJSON_strdup()
186 CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks *hooks) in cJSON_InitHooks() argument
188 if (hooks == NULL) { in cJSON_InitHooks()
197 if (hooks->malloc_fn != NULL) global_hooks.allocate = hooks->malloc_fn; in cJSON_InitHooks()
200 if (hooks->free_fn != NULL) global_hooks.deallocate = hooks->free_fn; in cJSON_InitHooks()
208 static cJSON *cJSON_New_Item(const internal_hooks *const hooks) in cJSON_New_Item() argument
210 cJSON *node = (cJSON *)hooks->allocate(sizeof(cJSON)); in cJSON_New_Item()
246 internal_hooks hooks; member
359 internal_hooks hooks; member
397 if (p->hooks.reallocate != NULL) { in ensure()
399 newbuffer = (unsigned char *)p->hooks.reallocate(p->buffer, newsize); in ensure()
401 p->hooks.deallocate(p->buffer); in ensure()
409 newbuffer = (unsigned char *)p->hooks.allocate(newsize); in ensure()
411 p->hooks.deallocate(p->buffer); in ensure()
419 p->hooks.deallocate(p->buffer); in ensure()
654 … output = (unsigned char *)input_buffer->hooks.allocate(allocation_length + sizeof("")); in parse_string()
717 if (output != NULL) input_buffer->hooks.deallocate(output); in parse_string()
894 buffer.hooks = global_hooks; in cJSON_ParseWithLengthOpts()
951 …unsigned char *print(const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks) in print() argument
960 buffer->buffer = (unsigned char *)hooks->allocate(default_buffer_size); in print()
963 buffer->hooks = *hooks; in print()
971 if (hooks->reallocate != NULL) { in print()
972 printed = (unsigned char *)hooks->reallocate(buffer->buffer, buffer->offset + 1); in print()
977 printed = (unsigned char *)hooks->allocate(buffer->offset + 1); in print()
983 hooks->deallocate(buffer->buffer); in print()
989 if (buffer->buffer != NULL) hooks->deallocate(buffer->buffer); in print()
991 if (printed != NULL) hooks->deallocate(printed); in print()
1022 p.hooks = global_hooks; in cJSON_PrintBuffered()
1045 p.hooks = global_hooks; in cJSON_PrintPreallocated()
1173 cJSON *new_item = cJSON_New_Item(&input_buffer->hooks); in parse_array()
1282 cJSON *new_item = cJSON_New_Item(&input_buffer->hooks); in parse_object()
1486 static cJSON *create_reference(const cJSON *item, const internal_hooks *const hooks) in create_reference() argument
1491 reference = cJSON_New_Item(hooks); in create_reference()
1548 … const char *const string, cJSON *const item, const internal_hooks *const hooks, const cJSON_bool … in add_item_to_object() argument
1559 new_key = (char *)cJSON_strdup((const unsigned char *)string, hooks); in add_item_to_object()
1565 …if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) hooks->deallocate(item->string); in add_item_to_object()