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

Function rt_strstr

src/klibc/kstring.c:285–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283 */
284#ifndef RT_KLIBC_USING_USER_STRSTR
285char *rt_strstr(const char *s1, const char *s2)
286{
287#ifdef RT_KLIBC_USING_LIBC_STRSTR
288 return strstr(s1, s2);
289#else
290 int l1 = 0, l2 = 0;
291
292 l2 = rt_strlen(s2);
293 if (!l2)
294 {
295 return (char *)s1;
296 }
297
298 l1 = rt_strlen(s1);
299 while (l1 >= l2)
300 {
301 l1 --;
302 if (!rt_memcmp(s1, s2, l2))
303 {
304 return (char *)s1;
305 }
306
307 s1 ++;
308 }
309
310 return RT_NULL;
311#endif /* RT_KLIBC_USING_LIBC_STRSTR */
312}
313#endif /* RT_KLIBC_USING_USER_STRSTR */
314RTM_EXPORT(rt_strstr);
315

Callers 9

fdt_scan_initrdFunction · 0.85
rt_fdt_bootargs_selectFunction · 0.85
ofw_get_prop_fuzzy_nameFunction · 0.85
ulog_voutputFunction · 0.85
client_parserFunction · 0.85
proc_findFunction · 0.85
rt_demo_thread_entryFunction · 0.85
drv_ethernet.cFile · 0.85

Calls 2

rt_strlenFunction · 0.85
rt_memcmpFunction · 0.85

Tested by

no test coverage detected