MCPcopy Create free account
hub / github.com/antirez/botlib / cJSON_GetArraySize

Function cJSON_GetArraySize

cJSON.c:1824–1845  ·  view source on GitHub ↗

Get Array size/item / object item. */

Source from the content-addressed store, hash-verified

1822
1823/* Get Array size/item / object item. */
1824CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array)
1825{
1826 cJSON *child = NULL;
1827 size_t size = 0;
1828
1829 if (array == NULL)
1830 {
1831 return 0;
1832 }
1833
1834 child = array->child;
1835
1836 while(child != NULL)
1837 {
1838 size++;
1839 child = child->next;
1840 }
1841
1842 /* FIXME: Can overflow here. Cannot be fixed without breaking the API */
1843
1844 return (int)size;
1845}
1846
1847static cJSON* get_array_item(const cJSON *array, size_t index)
1848{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected