Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 168786
b: refs/heads/master
c: a414f01
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Nov 19, 2009
1 parent f4a4cbf commit f572613
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6602b355c2cf8f4c628732827408606075288d28
refs/heads/master: a414f01ac2899f273ef8fe98fa44158ac12793f2
20 changes: 14 additions & 6 deletions trunk/lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,17 @@ EXPORT_SYMBOL(strlcat);
#undef strcmp
int strcmp(const char *cs, const char *ct)
{
signed char __res;
unsigned char c1, c2;

while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
c1 = *cs++;
c2 = *ct++;
if (c1 != c2)
return c1 < c2 ? -1 : 1;
if (!c1)
break;
}
return __res;
return 0;
}
EXPORT_SYMBOL(strcmp);
#endif
Expand All @@ -266,14 +270,18 @@ EXPORT_SYMBOL(strcmp);
*/
int strncmp(const char *cs, const char *ct, size_t count)
{
signed char __res = 0;
unsigned char c1, c2;

while (count) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
c1 = *cs++;
c2 = *ct++;
if (c1 != c2)
return c1 < c2 ? -1 : 1;
if (!c1)
break;
count--;
}
return __res;
return 0;
}
EXPORT_SYMBOL(strncmp);
#endif
Expand Down

0 comments on commit f572613

Please sign in to comment.