}
#endif
+#ifndef __HAVE_ARCH_STRSTR
+/**
+ * strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+char *(strstr)(const char *s1, const char *s2)
+{
+ size_t l1, l2 = strlen(s2);
+
+ if (!l2)
+ return (char *)s1;
+
+ for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
+ if (!memcmp(s1, s2, l2))
+ return (char *)s1;
+
+ return NULL;
+}
+#endif
+
#ifndef __HAVE_ARCH_MEMSET
/**
* memset - Fill a region of memory with the given value
}
#endif
-#ifndef __HAVE_ARCH_STRSTR
-/**
- * strstr - Find the first substring in a %NUL terminated string
- * @s1: The string to be searched
- * @s2: The string to search for
- */
-char *(strstr)(const char *s1, const char *s2)
-{
- int l1, l2;
-
- l2 = strlen(s2);
- if (!l2)
- return (char *) s1;
- l1 = strlen(s1);
- while (l1 >= l2) {
- l1--;
- if (!memcmp(s1,s2,l2))
- return (char *) s1;
- s1++;
- }
- return NULL;
-}
-#endif
-
#ifndef __HAVE_ARCH_MEMCHR
/**
* memchr - Find a character in an area of memory.