|
@@ -108,16 +108,25 @@ static cJSON *cJSON_New_Item(void)
|
|
/* Delete a cJSON structure. */
|
|
/* Delete a cJSON structure. */
|
|
void cJSON_Delete(cJSON *c)
|
|
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);
|
|
|
|
- cJSON_free(c);
|
|
|
|
- c=next;
|
|
|
|
- }
|
|
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ cJSON_free(c);
|
|
|
|
+ c = next;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/* Parse the input text to generate a number, and populate the result into item. */
|
|
/* Parse the input text to generate a number, and populate the result into item. */
|