| 1949 | } |
| 1950 | |
| 1951 | static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) |
| 1952 | { |
| 1953 | cJSON *current_element = NULL; |
| 1954 | |
| 1955 | if ((object == NULL) || (name == NULL)) |
| 1956 | { |
| 1957 | return NULL; |
| 1958 | } |
| 1959 | |
| 1960 | current_element = object->child; |
| 1961 | if (case_sensitive) |
| 1962 | { |
| 1963 | while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) |
| 1964 | { |
| 1965 | current_element = current_element->next; |
| 1966 | } |
| 1967 | } |
| 1968 | else |
| 1969 | { |
| 1970 | while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) |
| 1971 | { |
| 1972 | current_element = current_element->next; |
| 1973 | } |
| 1974 | } |
| 1975 | |
| 1976 | if ((current_element == NULL) || (current_element->string == NULL)) { |
| 1977 | return NULL; |
| 1978 | } |
| 1979 | |
| 1980 | return current_element; |
| 1981 | } |
| 1982 | |
| 1983 | CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) |
| 1984 | { |
no test coverage detected