Get Array size/item / object item. */
| 1722 | |
| 1723 | /* Get Array size/item / object item. */ |
| 1724 | CJSON_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 | |
| 1747 | static cJSON* get_array_item(const cJSON *array, size_t index) |
| 1748 | { |
nothing calls this directly
no outgoing calls
no test coverage detected