MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cJSON_AddItemToArray

Function cJSON_AddItemToArray

lib/cJSON.c:1861–1886  ·  view source on GitHub ↗

Add item to array/object. */

Source from the content-addressed store, hash-verified

1859
1860/* Add item to array/object. */
1861void 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
1888void _cJSON_AddItemToObject(cJSON *object, const str *string, cJSON *item)
1889{

Callers 6

_cJSON_AddItemToObjectFunction · 0.70
cJSON_AddItemToObjectFunction · 0.70
cJSON_AddItemToObjectCSFunction · 0.70
cJSON_InsertItemInArrayFunction · 0.70
payload_add_paramsFunction · 0.50

Calls 1

suffix_objectFunction · 0.70

Tested by

no test coverage detected