| 1903 | } |
| 1904 | |
| 1905 | void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) |
| 1906 | { |
| 1907 | if (!item) |
| 1908 | { |
| 1909 | return; |
| 1910 | } |
| 1911 | |
| 1912 | /* free old key and set new one */ |
| 1913 | if (item->string) |
| 1914 | { |
| 1915 | cJSON_free(item->string); |
| 1916 | } |
| 1917 | item->string = (char*)cJSON_strdup((const unsigned char*)string); |
| 1918 | |
| 1919 | cJSON_AddItemToArray(object,item); |
| 1920 | } |
| 1921 | |
| 1922 | /* Add an item to an object with constant string as key */ |
| 1923 | void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) |
no test coverage detected