aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/string.c b/lib/string.c
index 453f35994eb6..38e4ca08e757 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -891,36 +891,6 @@ void *memscan(void *addr, int c, size_t size)
891EXPORT_SYMBOL(memscan); 891EXPORT_SYMBOL(memscan);
892#endif 892#endif
893 893
894/*
895 * Merge two NULL-terminated pointer arrays into a newly allocated
896 * array, which is also NULL-terminated. Nomenclature is inspired by
897 * memset_p() and memcat() found elsewhere in the kernel source tree.
898 */
899void **__memcat_p(void **a, void **b)
900{
901 void **p = a, **new;
902 int nr;
903
904 /* count the elements in both arrays */
905 for (nr = 0, p = a; *p; nr++, p++)
906 ;
907 for (p = b; *p; nr++, p++)
908 ;
909 /* one for the NULL-terminator */
910 nr++;
911
912 new = kmalloc_array(nr, sizeof(void *), GFP_KERNEL);
913 if (!new)
914 return NULL;
915
916 /* nr -> last index; p points to NULL in b[] */
917 for (nr--; nr >= 0; nr--, p = p == b ? &a[nr] : p - 1)
918 new[nr] = *p;
919
920 return new;
921}
922EXPORT_SYMBOL_GPL(__memcat_p);
923
924#ifndef __HAVE_ARCH_STRSTR 894#ifndef __HAVE_ARCH_STRSTR
925/** 895/**
926 * strstr - Find the first substring in a %NUL terminated string 896 * strstr - Find the first substring in a %NUL terminated string