Add item to array/object. */
| 1859 | |
| 1860 | /* Add item to array/object. */ |
| 1861 | void cJSON_AddItemToArray(cJSON *array, cJSON *item) |
| 1862 | { |
| 1863 | cJSON *child = NULL; |
| 1864 | |
| 1865 | if ((item == NULL) || (array == NULL)) |
| 1866 | { |
| 1867 | return; |
| 1868 | } |
| 1869 | |
| 1870 | child = array->child; |
| 1871 | |
| 1872 | if (child == NULL) |
| 1873 | { |
| 1874 | /* list is empty, start new one */ |
| 1875 | array->child = item; |
| 1876 | } |
| 1877 | else |
| 1878 | { |
| 1879 | /* append to the end */ |
| 1880 | while (child->next) |
| 1881 | { |
| 1882 | child = child->next; |
| 1883 | } |
| 1884 | suffix_object(child, item); |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | void _cJSON_AddItemToObject(cJSON *object, const str *string, cJSON *item) |
| 1889 | { |
no test coverage detected