Get Array size/item / object item. */
| 1718 | |
| 1719 | /* Get Array size/item / object item. */ |
| 1720 | CJSON_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 | |
| 1743 | static cJSON* get_array_item(const cJSON *array, size_t index) |
| 1744 | { |
no outgoing calls
no test coverage detected