remove obsolete comment
[kugel-rb.git] / firmware / libc / strstr.c
blobd600bbeb64380cfb2175e9d3e775800f91ac3ea7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2002 Manuel Novoa III
10 * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
12 * Licensed under the LGPL v2.1, code originally in uclibc
14 ****************************************************************************/
15 #include <string.h>
17 /* NOTE: This is the simple-minded O(len(s1) * len(s2)) worst-case approach. */
19 char *strstr(const char *s1, const char *s2)
21 register const char *s = s1;
22 register const char *p = s2;
24 do {
25 if (!*p) {
26 return (char *) s1;
28 if (*p == *s) {
29 ++p;
30 ++s;
31 } else {
32 p = s2;
33 if (!*s) {
34 return NULL;
36 s = ++s1;
38 } while (1);