git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
uml: convert to seq_file/proc_fops
[safe/jmp/linux-2.6]
/
lib
/
string.c
diff --git
a/lib/string.c
b/lib/string.c
index
b19b87a
..
e96421a
100644
(file)
--- a/
lib/string.c
+++ b/
lib/string.c
@@
-246,13
+246,17
@@
EXPORT_SYMBOL(strlcat);
#undef strcmp
int strcmp(const char *cs, const char *ct)
{
#undef strcmp
int strcmp(const char *cs, const char *ct)
{
-
signed char __res
;
+
unsigned char c1, c2
;
while (1) {
while (1) {
- if ((__res = *cs - *ct++) != 0 || !*cs++)
+ c1 = *cs++;
+ c2 = *ct++;
+ if (c1 != c2)
+ return c1 < c2 ? -1 : 1;
+ if (!c1)
break;
}
break;
}
- return
__res
;
+ return
0
;
}
EXPORT_SYMBOL(strcmp);
#endif
}
EXPORT_SYMBOL(strcmp);
#endif
@@
-266,14
+270,18
@@
EXPORT_SYMBOL(strcmp);
*/
int strncmp(const char *cs, const char *ct, size_t count)
{
*/
int strncmp(const char *cs, const char *ct, size_t count)
{
-
signed char __res = 0
;
+
unsigned char c1, c2
;
while (count) {
while (count) {
- if ((__res = *cs - *ct++) != 0 || !*cs++)
+ c1 = *cs++;
+ c2 = *ct++;
+ if (c1 != c2)
+ return c1 < c2 ? -1 : 1;
+ if (!c1)
break;
count--;
}
break;
count--;
}
- return
__res
;
+ return
0
;
}
EXPORT_SYMBOL(strncmp);
#endif
}
EXPORT_SYMBOL(strncmp);
#endif