MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / ofw_prop_index_of_string

Function ofw_prop_index_of_string

components/drivers/ofw/base.c:308–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308static 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
334static rt_int32_t ofw_strcasecmp(const char *cs, const char *ct)
335{

Callers 2

Calls 1

rt_strlenFunction · 0.85

Tested by

no test coverage detected