| 2345 | } |
| 2346 | |
| 2347 | static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) |
| 2348 | { |
| 2349 | if ((replacement == NULL) || (string == NULL)) |
| 2350 | { |
| 2351 | return false; |
| 2352 | } |
| 2353 | |
| 2354 | /* replace the name in the replacement */ |
| 2355 | if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) |
| 2356 | { |
| 2357 | cJSON_free(replacement->string); |
| 2358 | } |
| 2359 | replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); |
| 2360 | replacement->type &= ~cJSON_StringIsConst; |
| 2361 | |
| 2362 | return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); |
| 2363 | } |
| 2364 | |
| 2365 | CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) |
| 2366 | { |
no test coverage detected