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

Function cJSON_GetArraySize

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

Get Array size/item / object item. */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected