| 2087 | } |
| 2088 | |
| 2089 | void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) |
| 2090 | { |
| 2091 | size_t i = 0; |
| 2092 | cJSON *c = object->child; |
| 2093 | while(c && cJSON_strcasecmp((unsigned char*)c->string, (const unsigned char*)string)) |
| 2094 | { |
| 2095 | i++; |
| 2096 | c = c->next; |
| 2097 | } |
| 2098 | if(c) |
| 2099 | { |
| 2100 | /* free the old string if not const */ |
| 2101 | if (!(newitem->type & cJSON_StringIsConst) && newitem->string) |
| 2102 | { |
| 2103 | cJSON_free(newitem->string); |
| 2104 | } |
| 2105 | |
| 2106 | newitem->string = (char*)cJSON_strdup((const unsigned char*)string); |
| 2107 | ReplaceItemInArray(object, i, newitem); |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | /* Create basic types: */ |
| 2112 | cJSON *cJSON_CreateNull(void) |
nothing calls this directly
no test coverage detected