Add cJSON_Allocators new style allocator struct

This commit is contained in:
Max Bruckner
2018-02-01 10:26:58 +01:00
parent 649af9c2c3
commit 440ba84d08
5 changed files with 90 additions and 52 deletions

View File

@ -33,11 +33,11 @@ void reset(cJSON *item) {
}
if ((item->valuestring != NULL) && !(item->type & cJSON_IsReference))
{
global_configuration.deallocate(item->valuestring);
global_configuration.allocators.deallocate(item->valuestring, global_configuration.userdata);
}
if ((item->string != NULL) && !(item->type & cJSON_StringIsConst))
{
global_configuration.deallocate(item->string);
global_configuration.allocators.deallocate(item->string, global_configuration.userdata);
}
memset(item, 0, sizeof(cJSON));