Get Array size/item / object item. */
| 1822 | |
| 1823 | /* Get Array size/item / object item. */ |
| 1824 | CJSON_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 | |
| 1847 | static cJSON* get_array_item(const cJSON *array, size_t index) |
| 1848 | { |
nothing calls this directly
no outgoing calls
no test coverage detected