projects
/
linux-2.6-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[linux-2.6-block.git]
/
lib
/
string.c
diff --git
a/lib/string.c
b/lib/string.c
index a1cdcfcc42d06db93e81928f022d4c70b82959be..f71bead1be3efaf5694cbbe1df1d59edb18b74ae 100644
(file)
--- a/
lib/string.c
+++ b/
lib/string.c
@@
-36,25
+36,21
@@
int strnicmp(const char *s1, const char *s2, size_t len)
/* Yes, Virginia, it had better be unsigned */
unsigned char c1, c2;
/* Yes, Virginia, it had better be unsigned */
unsigned char c1, c2;
- c1 = c2 = 0;
- if (len) {
- do {
- c1 = *s1;
- c2 = *s2;
- s1++;
- s2++;
- if (!c1)
- break;
- if (!c2)
- break;
- if (c1 == c2)
- continue;
- c1 = tolower(c1);
- c2 = tolower(c2);
- if (c1 != c2)
- break;
- } while (--len);
- }
+ if (!len)
+ return 0;
+
+ do {
+ c1 = *s1++;
+ c2 = *s2++;
+ if (!c1 || !c2)
+ break;
+ if (c1 == c2)
+ continue;
+ c1 = tolower(c1);
+ c2 = tolower(c2);
+ if (c1 != c2)
+ break;
+ } while (--len);
return (int)c1 - (int)c2;
}
EXPORT_SYMBOL(strnicmp);
return (int)c1 - (int)c2;
}
EXPORT_SYMBOL(strnicmp);
@@
-693,13
+689,13
@@
EXPORT_SYMBOL(strstr);
*/
char *strnstr(const char *s1, const char *s2, size_t len)
{
*/
char *strnstr(const char *s1, const char *s2, size_t len)
{
- size_t l
1 = len, l
2;
+ size_t l2;
l2 = strlen(s2);
if (!l2)
return (char *)s1;
l2 = strlen(s2);
if (!l2)
return (char *)s1;
- while (l
1
>= l2) {
- l
1
--;
+ while (l
en
>= l2) {
+ l
en
--;
if (!memcmp(s1, s2, l2))
return (char *)s1;
s1++;
if (!memcmp(s1, s2, l2))
return (char *)s1;
s1++;