MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / get_object_item

Function get_object_item

TheForceEngine/TFE_System/cJSON.c:1885–1915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1883}
1884
1885static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive)
1886{
1887 cJSON *current_element = NULL;
1888
1889 if ((object == NULL) || (name == NULL))
1890 {
1891 return NULL;
1892 }
1893
1894 current_element = object->child;
1895 if (case_sensitive)
1896 {
1897 while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0))
1898 {
1899 current_element = current_element->next;
1900 }
1901 }
1902 else
1903 {
1904 while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0))
1905 {
1906 current_element = current_element->next;
1907 }
1908 }
1909
1910 if ((current_element == NULL) || (current_element->string == NULL)) {
1911 return NULL;
1912 }
1913
1914 return current_element;
1915}
1916
1917CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string)
1918{

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