| 1934 | } |
| 1935 | |
| 1936 | static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) |
| 1937 | { |
| 1938 | cJSON *current_element = NULL; |
| 1939 | |
| 1940 | if ((object == NULL) || (name == NULL)) |
| 1941 | { |
| 1942 | return NULL; |
| 1943 | } |
| 1944 | |
| 1945 | current_element = object->child; |
| 1946 | if (case_sensitive) |
| 1947 | { |
| 1948 | while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) |
| 1949 | { |
| 1950 | current_element = current_element->next; |
| 1951 | } |
| 1952 | } |
| 1953 | else |
| 1954 | { |
| 1955 | while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) |
| 1956 | { |
| 1957 | current_element = current_element->next; |
| 1958 | } |
| 1959 | } |
| 1960 | |
| 1961 | if ((current_element == NULL) || (current_element->string == NULL)) { |
| 1962 | return NULL; |
| 1963 | } |
| 1964 | |
| 1965 | return current_element; |
| 1966 | } |
| 1967 | |
| 1968 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) |
| 1969 | { |
no test coverage detected
searching dependent graphs…