reformatting: cJSON_Delete

This commit is contained in:
Max Bruckner 2016-09-27 23:42:50 +07:00
parent 55488f66f6
commit 46cfa68a2b

19
cJSON.c
View File

@ -111,12 +111,21 @@ void cJSON_Delete(cJSON *c)
cJSON *next;
while (c)
{
next=c->next;
if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child);
if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
if (!(c->type&cJSON_StringIsConst) && c->string) cJSON_free(c->string);
next = c->next;
if (!(c->type & cJSON_IsReference) && c->child)
{
cJSON_Delete(c->child);
}
if (!(c->type & cJSON_IsReference) && c->valuestring)
{
cJSON_free(c->valuestring);
}
if (!(c->type & cJSON_StringIsConst) && c->string)
{
cJSON_free(c->string);
}
cJSON_free(c);
c=next;
c = next;
}
}