diff options
author | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-10-29 16:07:11 +0000 |
commit | fa40f30b4253b1e05c46cc5e0c111176825b7623 (patch) | |
tree | 76cf2d26c0ce0ee7c6a2c1a1a2b65bc4d8e33029 /mdk-stage1/dietlibc/lib/strstr.c | |
parent | 327bd24f8e4291bd1882de1990dd7339f781a9cb (diff) | |
download | drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.gz drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.bz2 drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.tar.xz drakx-fa9b77142ea63ce782bd11d9a4ce0657d37747a0.zip |
This commit was manufactured by cvs2svn to create tag 'Corpo_2_1_1'.Corpo_2_1_1
Diffstat (limited to 'mdk-stage1/dietlibc/lib/strstr.c')
-rw-r--r-- | mdk-stage1/dietlibc/lib/strstr.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <string.h> 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; } |