mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
[STRING]: Move strcasecmp/strncasecmp to lib/string.c
We have several platforms using local copies of identical code. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
357418e7ca
commit
ded220bd8f
17 changed files with 39 additions and 151 deletions
28
lib/string.c
28
lib/string.c
|
@ -60,6 +60,34 @@ int strnicmp(const char *s1, const char *s2, size_t len)
|
|||
EXPORT_SYMBOL(strnicmp);
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCASECMP
|
||||
int strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
do {
|
||||
c1 = tolower(*s1++);
|
||||
c2 = tolower(*s2++);
|
||||
} while (c1 == c2 && c1 != 0);
|
||||
return c1 - c2;
|
||||
}
|
||||
EXPORT_SYMBOL(strcasecmp);
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRNCASECMP
|
||||
int strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
do {
|
||||
c1 = tolower(*s1++);
|
||||
c2 = tolower(*s2++);
|
||||
} while ((--n > 0) && c1 == c2 && c1 != 0);
|
||||
return c1 - c2;
|
||||
}
|
||||
EXPORT_SYMBOL(strncasecmp);
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_STRCPY
|
||||
/**
|
||||
* strcpy - Copy a %NUL terminated string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue