Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

+39 -151
-1
arch/alpha/lib/Makefile
··· 36 36 $(ev6-y)csum_ipv6_magic.o \ 37 37 $(ev6-y)clear_page.o \ 38 38 $(ev6-y)copy_page.o \ 39 - strcasecmp.o \ 40 39 fpreg.o \ 41 40 callback_srm.o srm_puts.o srm_printk.o 42 41
-26
arch/alpha/lib/strcasecmp.c
··· 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 - }
-2
arch/powerpc/kernel/ppc_ksyms.c
··· 84 84 EXPORT_SYMBOL(strcat); 85 85 EXPORT_SYMBOL(strlen); 86 86 EXPORT_SYMBOL(strcmp); 87 - EXPORT_SYMBOL(strcasecmp); 88 - EXPORT_SYMBOL(strncasecmp); 89 87 90 88 EXPORT_SYMBOL(csum_partial); 91 89 EXPORT_SYMBOL(csum_partial_copy_generic);
+2 -3
arch/powerpc/lib/Makefile
··· 7 7 endif 8 8 9 9 ifeq ($(CONFIG_PPC_MERGE),y) 10 - obj-y := string.o strcase.o 10 + obj-y := string.o 11 11 obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o 12 12 endif 13 13 14 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 \ 16 - strcase.o 15 + memcpy_64.o usercopy_64.o mem_64.o string.o 17 16 obj-$(CONFIG_QUICC_ENGINE) += rheap.o 18 17 obj-$(CONFIG_XMON) += sstep.o 19 18 obj-$(CONFIG_KPROBES) += sstep.o
-25
arch/powerpc/lib/strcase.c
··· 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 - }
-2
arch/ppc/kernel/ppc_ksyms.c
··· 93 93 EXPORT_SYMBOL(strcat); 94 94 EXPORT_SYMBOL(strlen); 95 95 EXPORT_SYMBOL(strcmp); 96 - EXPORT_SYMBOL(strcasecmp); 97 - EXPORT_SYMBOL(strncasecmp); 98 96 EXPORT_SYMBOL(__div64_32); 99 97 100 98 EXPORT_SYMBOL(csum_partial);
+1 -1
arch/ppc/lib/Makefile
··· 2 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 7 obj-$(CONFIG_8xx) += rheap.o 8 8 obj-$(CONFIG_CPM2) += rheap.o
-24
arch/ppc/lib/strcase.c
··· 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 - }
+1 -1
arch/sh/lib/Makefile
··· 3 3 # 4 4 5 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 7 div64-generic.o 8 8 9 9 memcpy-y := memcpy.o
-26
arch/sh/lib/strcasecmp.c
··· 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 - }
+1 -1
arch/xtensa/lib/Makefile
··· 2 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 6 usercopy.o strncpy_user.o strnlen_user.o 7 7 lib-$(CONFIG_PCI) += pci-auto.o
-32
arch/xtensa/lib/strcasecmp.c
··· 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 - }
-2
include/asm-alpha/string.h
··· 61 61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ 62 62 : __memsetw((s),(c),(n))) 63 63 64 - extern int strcasecmp(const char *, const char *); 65 - 66 64 #endif /* __KERNEL__ */ 67 65 68 66 #endif /* __ALPHA_STRING_H__ */
-2
include/asm-powerpc/string.h
··· 14 14 #define __HAVE_ARCH_MEMCMP 15 15 #define __HAVE_ARCH_MEMCHR 16 16 17 - extern int strcasecmp(const char *, const char *); 18 - extern int strncasecmp(const char *, const char *, __kernel_size_t); 19 17 extern char * strcpy(char *,const char *); 20 18 extern char * strncpy(char *,const char *, __kernel_size_t); 21 19 extern __kernel_size_t strlen(const char *);
-3
include/asm-sh/string.h
··· 126 126 #define __HAVE_ARCH_STRLEN 127 127 extern size_t strlen(const char *); 128 128 129 - /* arch/sh/lib/strcasecmp.c */ 130 - extern int strcasecmp(const char *, const char *); 131 - 132 129 #endif /* __KERNEL__ */ 133 130 134 131 #endif /* __ASM_SH_STRING_H */
+6
include/linux/string.h
··· 47 47 #ifndef __HAVE_ARCH_STRNICMP 48 48 extern int strnicmp(const char *, const char *, __kernel_size_t); 49 49 #endif 50 + #ifndef __HAVE_ARCH_STRCASECMP 51 + extern int strcasecmp(const char *s1, const char *s2); 52 + #endif 53 + #ifndef __HAVE_ARCH_STRNCASECMP 54 + extern int strncasecmp(const char *s1, const char *s2, size_t n); 55 + #endif 50 56 #ifndef __HAVE_ARCH_STRCHR 51 57 extern char * strchr(const char *,int); 52 58 #endif
+28
lib/string.c
··· 60 60 EXPORT_SYMBOL(strnicmp); 61 61 #endif 62 62 63 + #ifndef __HAVE_ARCH_STRCASECMP 64 + int strcasecmp(const char *s1, const char *s2) 65 + { 66 + int c1, c2; 67 + 68 + do { 69 + c1 = tolower(*s1++); 70 + c2 = tolower(*s2++); 71 + } while (c1 == c2 && c1 != 0); 72 + return c1 - c2; 73 + } 74 + EXPORT_SYMBOL(strcasecmp); 75 + #endif 76 + 77 + #ifndef __HAVE_ARCH_STRNCASECMP 78 + int strncasecmp(const char *s1, const char *s2, size_t n) 79 + { 80 + int c1, c2; 81 + 82 + do { 83 + c1 = tolower(*s1++); 84 + c2 = tolower(*s2++); 85 + } while ((--n > 0) && c1 == c2 && c1 != 0); 86 + return c1 - c2; 87 + } 88 + EXPORT_SYMBOL(strncasecmp); 89 + #endif 90 + 63 91 #ifndef __HAVE_ARCH_STRCPY 64 92 /** 65 93 * strcpy - Copy a %NUL terminated string