aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrĂ© Goddard Rosa <[email protected]>2010-03-05 13:43:12 -0800
committerLinus Torvalds <[email protected]>2010-03-06 11:26:35 -0800
commitd6a2eedfddcded92c8f9b0ac022a99c4134696b0 (patch)
tree6a0f38fbc74e839fc7712f8ebcb65cce75cdcc06
parenta11d2b64e1f2556953120d516241243ea365f0ae (diff)
lib/string.c: simplify strnstr()
Signed-off-by: AndrĂ© Goddard Rosa <[email protected]> Cc: Li Zefan <[email protected]> Cc: Joe Perches <[email protected]> Cc: Frederic Weisbecker <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--lib/string.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c
index 0f8624532082..f71bead1be3e 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -689,13 +689,13 @@ EXPORT_SYMBOL(strstr);
*/
char *strnstr(const char *s1, const char *s2, size_t len)
{
- size_t l1 = len, l2;
+ size_t l2;
l2 = strlen(s2);
if (!l2)
return (char *)s1;
- while (l1 >= l2) {
- l1--;
+ while (len >= l2) {
+ len--;
if (!memcmp(s1, s2, l2))
return (char *)s1;
s1++;