| 306 | } |
| 307 | |
| 308 | static int ofw_prop_index_of_string(struct rt_ofw_prop *prop, const char *string, |
| 309 | rt_int32_t (*cmp)(const char *cs, const char *ct)) |
| 310 | { |
| 311 | int index = -1; |
| 312 | rt_size_t len = prop->length, slen = 0; |
| 313 | const char *value = prop->value; |
| 314 | |
| 315 | for (int idx = 0; len > 0; ++idx) |
| 316 | { |
| 317 | /* Add '\0' */ |
| 318 | slen = rt_strlen(value) + 1; |
| 319 | |
| 320 | if (!cmp(value, string)) |
| 321 | { |
| 322 | index = idx; |
| 323 | |
| 324 | break; |
| 325 | } |
| 326 | |
| 327 | len -= slen; |
| 328 | value += slen; |
| 329 | } |
| 330 | |
| 331 | return index; |
| 332 | } |
| 333 | |
| 334 | static rt_int32_t ofw_strcasecmp(const char *cs, const char *ct) |
| 335 | { |
no test coverage detected