From de47eb59bb829423b1d0f47ba13099073999b3cb Mon Sep 17 00:00:00 2001 From: Nicolas Planel Date: Wed, 29 Oct 2003 16:07:11 +0000 Subject: Corporate Server 2.1.1 release --- mdk-stage1/dietlibc/lib/strstr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mdk-stage1/dietlibc/lib/strstr.c') diff --git a/mdk-stage1/dietlibc/lib/strstr.c b/mdk-stage1/dietlibc/lib/strstr.c index 641d9d7ac..0632cc28a 100644 --- a/mdk-stage1/dietlibc/lib/strstr.c +++ b/mdk-stage1/dietlibc/lib/strstr.c @@ -2,12 +2,14 @@ #include char *strstr(const char *haystack, const char *needle) { - int nl=strlen(needle); - int hl=strlen(haystack); + size_t nl=strlen(needle); + size_t hl=strlen(haystack); int i; + if (!nl) goto found; if (nl>hl) return 0; for (i=hl-nl+1; i; --i) { - if (!memcmp(haystack,needle,nl)) + if (*haystack==*needle && !memcmp(haystack,needle,nl)) +found: return (char*)haystack; ++haystack; } -- cgit v1.2.1