| 1774 | } |
| 1775 | |
| 1776 | static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) |
| 1777 | { |
| 1778 | cJSON *current_element = NULL; |
| 1779 | |
| 1780 | if ((object == NULL) || (name == NULL)) |
| 1781 | { |
| 1782 | return NULL; |
| 1783 | } |
| 1784 | |
| 1785 | current_element = object->child; |
| 1786 | if (case_sensitive) |
| 1787 | { |
| 1788 | while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) |
| 1789 | { |
| 1790 | current_element = current_element->next; |
| 1791 | } |
| 1792 | } |
| 1793 | else |
| 1794 | { |
| 1795 | while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) |
| 1796 | { |
| 1797 | current_element = current_element->next; |
| 1798 | } |
| 1799 | } |
| 1800 | |
| 1801 | if ((current_element == NULL) || (current_element->string == NULL)) { |
| 1802 | return NULL; |
| 1803 | } |
| 1804 | |
| 1805 | return current_element; |
| 1806 | } |
| 1807 | |
| 1808 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) |
| 1809 | { |
no test coverage detected