reformatting: cJSON_DetachItemFromObject

This commit is contained in:
Max Bruckner 2016-09-30 10:42:52 +07:00
parent 6e5063f9cc
commit 96ec74c9d5

18
cJSON.c
View File

@ -1746,7 +1746,23 @@ void cJSON_DeleteItemFromArray(cJSON *array, int which)
cJSON_Delete(cJSON_DetachItemFromArray(array, which)); cJSON_Delete(cJSON_DetachItemFromArray(array, which));
} }
cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;} cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string)
{
int i = 0;
cJSON *c = object->child;
while (c && cJSON_strcasecmp(c->string,string))
{
i++;
c = c->next;
}
if (c)
{
return cJSON_DetachItemFromArray(object, i);
}
return 0;
}
void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));} void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));}
/* Replace array/object items with new ones. */ /* Replace array/object items with new ones. */