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

Function get_object_item

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

Source from the content-addressed store, hash-verified

1774}
1775
1776static 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
1808CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string)
1809{

Callers 4

cJSON_GetObjectItemFunction · 0.85
replace_item_in_objectFunction · 0.85
cJSON_CompareFunction · 0.85

Calls 1

case_insensitive_strcmpFunction · 0.85

Tested by

no test coverage detected