MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / cJSON_GetArraySize

Function cJSON_GetArraySize

framework/utils/cJSON.c:1720–1741  ·  view source on GitHub ↗

Get Array size/item / object item. */

Source from the content-addressed store, hash-verified

1718
1719/* Get Array size/item / object item. */
1720CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array)
1721{
1722 cJSON *child = NULL;
1723 size_t size = 0;
1724
1725 if (array == NULL)
1726 {
1727 return 0;
1728 }
1729
1730 child = array->child;
1731
1732 while(child != NULL)
1733 {
1734 size++;
1735 child = child->next;
1736 }
1737
1738 /* FIXME: Can overflow here. Cannot be fixed without breaking the API */
1739
1740 return (int)size;
1741}
1742
1743static cJSON* get_array_item(const cJSON *array, size_t index)
1744{

Callers 2

getSizeMethod · 0.85
deleteItemMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected