Skip to content

Commit

Permalink
[STRING]: Move strcasecmp/strncasecmp to lib/string.c
Browse files Browse the repository at this point in the history
We have several platforms using local copies of identical
code.

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
David S. Miller committed Apr 26, 2007
1 parent 357418e commit ded220b
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 151 deletions.
1 change: 0 additions & 1 deletion arch/alpha/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \
$(ev6-y)csum_ipv6_magic.o \
$(ev6-y)clear_page.o \
$(ev6-y)copy_page.o \
strcasecmp.o \
fpreg.o \
callback_srm.o srm_puts.o srm_printk.o

Expand Down
26 changes: 0 additions & 26 deletions arch/alpha/lib/strcasecmp.c

This file was deleted.

2 changes: 0 additions & 2 deletions arch/powerpc/kernel/ppc_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ EXPORT_SYMBOL(strncpy);
EXPORT_SYMBOL(strcat);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strcasecmp);
EXPORT_SYMBOL(strncasecmp);

EXPORT_SYMBOL(csum_partial);
EXPORT_SYMBOL(csum_partial_copy_generic);
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ EXTRA_CFLAGS += -mno-minimal-toc
endif

ifeq ($(CONFIG_PPC_MERGE),y)
obj-y := string.o strcase.o
obj-y := string.o
obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o
endif

obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
memcpy_64.o usercopy_64.o mem_64.o string.o \
strcase.o
memcpy_64.o usercopy_64.o mem_64.o string.o
obj-$(CONFIG_QUICC_ENGINE) += rheap.o
obj-$(CONFIG_XMON) += sstep.o
obj-$(CONFIG_KPROBES) += sstep.o
Expand Down
25 changes: 0 additions & 25 deletions arch/powerpc/lib/strcase.c

This file was deleted.

2 changes: 0 additions & 2 deletions arch/ppc/kernel/ppc_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ EXPORT_SYMBOL(strncpy);
EXPORT_SYMBOL(strcat);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strcasecmp);
EXPORT_SYMBOL(strncasecmp);
EXPORT_SYMBOL(__div64_32);

EXPORT_SYMBOL(csum_partial);
Expand Down
2 changes: 1 addition & 1 deletion arch/ppc/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Makefile for ppc-specific library files..
#

obj-y := checksum.o string.o strcase.o div64.o
obj-y := checksum.o string.o div64.o

obj-$(CONFIG_8xx) += rheap.o
obj-$(CONFIG_CPM2) += rheap.o
24 changes: 0 additions & 24 deletions arch/ppc/lib/strcase.c

This file was deleted.

2 changes: 1 addition & 1 deletion arch/sh/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

lib-y = delay.o memset.o memmove.o memchr.o \
checksum.o strcasecmp.o strlen.o div64.o udivdi3.o \
checksum.o strlen.o div64.o udivdi3.o \
div64-generic.o

memcpy-y := memcpy.o
Expand Down
26 changes: 0 additions & 26 deletions arch/sh/lib/strcasecmp.c

This file was deleted.

2 changes: 1 addition & 1 deletion arch/xtensa/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Makefile for Xtensa-specific library files.
#

lib-y += memcopy.o memset.o checksum.o strcasecmp.o \
lib-y += memcopy.o memset.o checksum.o \
usercopy.o strncpy_user.o strnlen_user.o
lib-$(CONFIG_PCI) += pci-auto.o
32 changes: 0 additions & 32 deletions arch/xtensa/lib/strcasecmp.c

This file was deleted.

2 changes: 0 additions & 2 deletions include/asm-alpha/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ extern void * __memsetw(void *dest, unsigned short, size_t count);
? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
: __memsetw((s),(c),(n)))

extern int strcasecmp(const char *, const char *);

#endif /* __KERNEL__ */

#endif /* __ALPHA_STRING_H__ */
2 changes: 0 additions & 2 deletions include/asm-powerpc/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#define __HAVE_ARCH_MEMCMP
#define __HAVE_ARCH_MEMCHR

extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, __kernel_size_t);
extern char * strcpy(char *,const char *);
extern char * strncpy(char *,const char *, __kernel_size_t);
extern __kernel_size_t strlen(const char *);
Expand Down
3 changes: 0 additions & 3 deletions include/asm-sh/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ extern void *memchr(const void *__s, int __c, size_t __n);
#define __HAVE_ARCH_STRLEN
extern size_t strlen(const char *);

/* arch/sh/lib/strcasecmp.c */
extern int strcasecmp(const char *, const char *);

#endif /* __KERNEL__ */

#endif /* __ASM_SH_STRING_H */
6 changes: 6 additions & 0 deletions include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t);
#ifndef __HAVE_ARCH_STRNICMP
extern int strnicmp(const char *, const char *, __kernel_size_t);
#endif
#ifndef __HAVE_ARCH_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
#endif
#ifndef __HAVE_ARCH_STRNCASECMP
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifndef __HAVE_ARCH_STRCHR
extern char * strchr(const char *,int);
#endif
Expand Down
28 changes: 28 additions & 0 deletions lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ded220b

Please sign in to comment.