diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-03-29 04:18:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 04:54:39 -0400 |
commit | ded220bd8f0823771fc0a9bdf7f5bcbe543197b6 (patch) | |
tree | 530854859821c51cb3bcd9092140c535153627e5 /arch | |
parent | 357418e7cac16fed4ca558c6037d189d2109c9c2 (diff) |
[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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/lib/Makefile | 1 | ||||
-rw-r--r-- | arch/alpha/lib/strcasecmp.c | 26 | ||||
-rw-r--r-- | arch/powerpc/kernel/ppc_ksyms.c | 2 | ||||
-rw-r--r-- | arch/powerpc/lib/Makefile | 5 | ||||
-rw-r--r-- | arch/powerpc/lib/strcase.c | 25 | ||||
-rw-r--r-- | arch/ppc/kernel/ppc_ksyms.c | 2 | ||||
-rw-r--r-- | arch/ppc/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/ppc/lib/strcase.c | 24 | ||||
-rw-r--r-- | arch/sh/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/lib/strcasecmp.c | 26 | ||||
-rw-r--r-- | arch/xtensa/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/xtensa/lib/strcasecmp.c | 32 |
12 files changed, 5 insertions, 144 deletions
diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile index 21cf624d7329..ea098f3b629f 100644 --- a/arch/alpha/lib/Makefile +++ b/arch/alpha/lib/Makefile | |||
@@ -36,7 +36,6 @@ lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \ | |||
36 | $(ev6-y)csum_ipv6_magic.o \ | 36 | $(ev6-y)csum_ipv6_magic.o \ |
37 | $(ev6-y)clear_page.o \ | 37 | $(ev6-y)clear_page.o \ |
38 | $(ev6-y)copy_page.o \ | 38 | $(ev6-y)copy_page.o \ |
39 | strcasecmp.o \ | ||
40 | fpreg.o \ | 39 | fpreg.o \ |
41 | callback_srm.o srm_puts.o srm_printk.o | 40 | callback_srm.o srm_puts.o srm_printk.o |
42 | 41 | ||
diff --git a/arch/alpha/lib/strcasecmp.c b/arch/alpha/lib/strcasecmp.c deleted file mode 100644 index 4e57a216feaf..000000000000 --- a/arch/alpha/lib/strcasecmp.c +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/alpha/lib/strcasecmp.c | ||
3 | */ | ||
4 | |||
5 | #include <linux/string.h> | ||
6 | |||
7 | |||
8 | /* We handle nothing here except the C locale. Since this is used in | ||
9 | only one place, on strings known to contain only 7 bit ASCII, this | ||
10 | is ok. */ | ||
11 | |||
12 | int strcasecmp(const char *a, const char *b) | ||
13 | { | ||
14 | int ca, cb; | ||
15 | |||
16 | do { | ||
17 | ca = *a++ & 0xff; | ||
18 | cb = *b++ & 0xff; | ||
19 | if (ca >= 'A' && ca <= 'Z') | ||
20 | ca += 'a' - 'A'; | ||
21 | if (cb >= 'A' && cb <= 'Z') | ||
22 | cb += 'a' - 'A'; | ||
23 | } while (ca == cb && ca != '\0'); | ||
24 | |||
25 | return ca - cb; | ||
26 | } | ||
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index ecee596d28f6..2f8e9c02c92a 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -84,8 +84,6 @@ EXPORT_SYMBOL(strncpy); | |||
84 | EXPORT_SYMBOL(strcat); | 84 | EXPORT_SYMBOL(strcat); |
85 | EXPORT_SYMBOL(strlen); | 85 | EXPORT_SYMBOL(strlen); |
86 | EXPORT_SYMBOL(strcmp); | 86 | EXPORT_SYMBOL(strcmp); |
87 | EXPORT_SYMBOL(strcasecmp); | ||
88 | EXPORT_SYMBOL(strncasecmp); | ||
89 | 87 | ||
90 | EXPORT_SYMBOL(csum_partial); | 88 | EXPORT_SYMBOL(csum_partial); |
91 | EXPORT_SYMBOL(csum_partial_copy_generic); | 89 | EXPORT_SYMBOL(csum_partial_copy_generic); |
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 4b1ba49fbd9e..450258de7ca1 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile | |||
@@ -7,13 +7,12 @@ EXTRA_CFLAGS += -mno-minimal-toc | |||
7 | endif | 7 | endif |
8 | 8 | ||
9 | ifeq ($(CONFIG_PPC_MERGE),y) | 9 | ifeq ($(CONFIG_PPC_MERGE),y) |
10 | obj-y := string.o strcase.o | 10 | obj-y := string.o |
11 | obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o | 11 | obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o |
12 | endif | 12 | endif |
13 | 13 | ||
14 | obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ | 14 | obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ |
15 | memcpy_64.o usercopy_64.o mem_64.o string.o \ | 15 | memcpy_64.o usercopy_64.o mem_64.o string.o |
16 | strcase.o | ||
17 | obj-$(CONFIG_QUICC_ENGINE) += rheap.o | 16 | obj-$(CONFIG_QUICC_ENGINE) += rheap.o |
18 | obj-$(CONFIG_XMON) += sstep.o | 17 | obj-$(CONFIG_XMON) += sstep.o |
19 | obj-$(CONFIG_KPROBES) += sstep.o | 18 | obj-$(CONFIG_KPROBES) += sstep.o |
diff --git a/arch/powerpc/lib/strcase.c b/arch/powerpc/lib/strcase.c deleted file mode 100644 index f8ec1eba3fdd..000000000000 --- a/arch/powerpc/lib/strcase.c +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #include <linux/types.h> | ||
2 | #include <linux/ctype.h> | ||
3 | #include <linux/string.h> | ||
4 | |||
5 | int strcasecmp(const char *s1, const char *s2) | ||
6 | { | ||
7 | int c1, c2; | ||
8 | |||
9 | do { | ||
10 | c1 = tolower(*s1++); | ||
11 | c2 = tolower(*s2++); | ||
12 | } while (c1 == c2 && c1 != 0); | ||
13 | return c1 - c2; | ||
14 | } | ||
15 | |||
16 | int strncasecmp(const char *s1, const char *s2, size_t n) | ||
17 | { | ||
18 | int c1, c2; | ||
19 | |||
20 | do { | ||
21 | c1 = tolower(*s1++); | ||
22 | c2 = tolower(*s2++); | ||
23 | } while ((--n > 0) && c1 == c2 && c1 != 0); | ||
24 | return c1 - c2; | ||
25 | } | ||
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 1318b6f4c3df..4ad499605d05 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -93,8 +93,6 @@ EXPORT_SYMBOL(strncpy); | |||
93 | EXPORT_SYMBOL(strcat); | 93 | EXPORT_SYMBOL(strcat); |
94 | EXPORT_SYMBOL(strlen); | 94 | EXPORT_SYMBOL(strlen); |
95 | EXPORT_SYMBOL(strcmp); | 95 | EXPORT_SYMBOL(strcmp); |
96 | EXPORT_SYMBOL(strcasecmp); | ||
97 | EXPORT_SYMBOL(strncasecmp); | ||
98 | EXPORT_SYMBOL(__div64_32); | 96 | EXPORT_SYMBOL(__div64_32); |
99 | 97 | ||
100 | EXPORT_SYMBOL(csum_partial); | 98 | EXPORT_SYMBOL(csum_partial); |
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile index 50358e4ea159..422bef9bae7b 100644 --- a/arch/ppc/lib/Makefile +++ b/arch/ppc/lib/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for ppc-specific library files.. | 2 | # Makefile for ppc-specific library files.. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := checksum.o string.o strcase.o div64.o | 5 | obj-y := checksum.o string.o div64.o |
6 | 6 | ||
7 | obj-$(CONFIG_8xx) += rheap.o | 7 | obj-$(CONFIG_8xx) += rheap.o |
8 | obj-$(CONFIG_CPM2) += rheap.o | 8 | obj-$(CONFIG_CPM2) += rheap.o |
diff --git a/arch/ppc/lib/strcase.c b/arch/ppc/lib/strcase.c deleted file mode 100644 index 3b0094cc2b52..000000000000 --- a/arch/ppc/lib/strcase.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | #include <linux/ctype.h> | ||
2 | #include <linux/types.h> | ||
3 | |||
4 | int strcasecmp(const char *s1, const char *s2) | ||
5 | { | ||
6 | int c1, c2; | ||
7 | |||
8 | do { | ||
9 | c1 = tolower(*s1++); | ||
10 | c2 = tolower(*s2++); | ||
11 | } while (c1 == c2 && c1 != 0); | ||
12 | return c1 - c2; | ||
13 | } | ||
14 | |||
15 | int strncasecmp(const char *s1, const char *s2, size_t n) | ||
16 | { | ||
17 | int c1, c2; | ||
18 | |||
19 | do { | ||
20 | c1 = tolower(*s1++); | ||
21 | c2 = tolower(*s2++); | ||
22 | } while ((--n > 0) && c1 == c2 && c1 != 0); | ||
23 | return c1 - c2; | ||
24 | } | ||
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index b5681e3f9684..0b9cca5c7cb4 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y = delay.o memset.o memmove.o memchr.o \ | 5 | lib-y = delay.o memset.o memmove.o memchr.o \ |
6 | checksum.o strcasecmp.o strlen.o div64.o udivdi3.o \ | 6 | checksum.o strlen.o div64.o udivdi3.o \ |
7 | div64-generic.o | 7 | div64-generic.o |
8 | 8 | ||
9 | memcpy-y := memcpy.o | 9 | memcpy-y := memcpy.o |
diff --git a/arch/sh/lib/strcasecmp.c b/arch/sh/lib/strcasecmp.c deleted file mode 100644 index 4e57a216feaf..000000000000 --- a/arch/sh/lib/strcasecmp.c +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/alpha/lib/strcasecmp.c | ||
3 | */ | ||
4 | |||
5 | #include <linux/string.h> | ||
6 | |||
7 | |||
8 | /* We handle nothing here except the C locale. Since this is used in | ||
9 | only one place, on strings known to contain only 7 bit ASCII, this | ||
10 | is ok. */ | ||
11 | |||
12 | int strcasecmp(const char *a, const char *b) | ||
13 | { | ||
14 | int ca, cb; | ||
15 | |||
16 | do { | ||
17 | ca = *a++ & 0xff; | ||
18 | cb = *b++ & 0xff; | ||
19 | if (ca >= 'A' && ca <= 'Z') | ||
20 | ca += 'a' - 'A'; | ||
21 | if (cb >= 'A' && cb <= 'Z') | ||
22 | cb += 'a' - 'A'; | ||
23 | } while (ca == cb && ca != '\0'); | ||
24 | |||
25 | return ca - cb; | ||
26 | } | ||
diff --git a/arch/xtensa/lib/Makefile b/arch/xtensa/lib/Makefile index ed935b58e8a4..6c4fdd86acd8 100644 --- a/arch/xtensa/lib/Makefile +++ b/arch/xtensa/lib/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for Xtensa-specific library files. | 2 | # Makefile for Xtensa-specific library files. |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += memcopy.o memset.o checksum.o strcasecmp.o \ | 5 | lib-y += memcopy.o memset.o checksum.o \ |
6 | usercopy.o strncpy_user.o strnlen_user.o | 6 | usercopy.o strncpy_user.o strnlen_user.o |
7 | lib-$(CONFIG_PCI) += pci-auto.o | 7 | lib-$(CONFIG_PCI) += pci-auto.o |
diff --git a/arch/xtensa/lib/strcasecmp.c b/arch/xtensa/lib/strcasecmp.c deleted file mode 100644 index 165b2d6effa5..000000000000 --- a/arch/xtensa/lib/strcasecmp.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/xtensa/lib/strcasecmp.c | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file "COPYING" in the main directory of | ||
6 | * this archive for more details. | ||
7 | * | ||
8 | * Copyright (C) 2002 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #include <linux/string.h> | ||
12 | |||
13 | |||
14 | /* We handle nothing here except the C locale. Since this is used in | ||
15 | only one place, on strings known to contain only 7 bit ASCII, this | ||
16 | is ok. */ | ||
17 | |||
18 | int strcasecmp(const char *a, const char *b) | ||
19 | { | ||
20 | int ca, cb; | ||
21 | |||
22 | do { | ||
23 | ca = *a++ & 0xff; | ||
24 | cb = *b++ & 0xff; | ||
25 | if (ca >= 'A' && ca <= 'Z') | ||
26 | ca += 'a' - 'A'; | ||
27 | if (cb >= 'A' && cb <= 'Z') | ||
28 | cb += 'a' - 'A'; | ||
29 | } while (ca == cb && ca != '\0'); | ||
30 | |||
31 | return ca - cb; | ||
32 | } | ||