MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / add_item_to_array

Function add_item_to_array

libapp2sys/src/main/cpp/cjson/cJSON.c:1852–1879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1850}
1851
1852static cJSON_bool add_item_to_array(cJSON *array, cJSON *item)
1853{
1854 cJSON *child = NULL;
1855
1856 if ((item == NULL) || (array == NULL))
1857 {
1858 return false;
1859 }
1860
1861 child = array->child;
1862
1863 if (child == NULL)
1864 {
1865 /* list is empty, start new one */
1866 array->child = item;
1867 }
1868 else
1869 {
1870 /* append to the end */
1871 while (child->next)
1872 {
1873 child = child->next;
1874 }
1875 suffix_object(child, item);
1876 }
1877
1878 return true;
1879}
1880
1881/* Add item to array/object. */
1882CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item)

Callers 4

cJSON_AddItemToArrayFunction · 0.85
add_item_to_objectFunction · 0.85
cJSON_InsertItemInArrayFunction · 0.85

Calls 1

suffix_objectFunction · 0.85

Tested by

no test coverage detected