| 1886 | } |
| 1887 | |
| 1888 | void _cJSON_AddItemToObject(cJSON *object, const str *string, cJSON *item) |
| 1889 | { |
| 1890 | if (!item) |
| 1891 | { |
| 1892 | return; |
| 1893 | } |
| 1894 | |
| 1895 | /* free old key and set new one */ |
| 1896 | if (item->string) |
| 1897 | { |
| 1898 | cJSON_free(item->string); |
| 1899 | } |
| 1900 | item->string = (char*)cJSON_strndup((const unsigned char*)string->s, string->len); |
| 1901 | |
| 1902 | cJSON_AddItemToArray(object,item); |
| 1903 | } |
| 1904 | |
| 1905 | void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) |
| 1906 | { |
no test coverage detected