This move kstrdup to lib/string.c. This a) matches its declaration in
string.h and b) avoids having to duplicate it for SLOB.
(this work has been sponsored in part by CELF)
Signed-off-by: Matt Mackall <[email protected]>
Index: 2.6.14-slob/lib/string.c
===================================================================
--- 2.6.14-slob.orig/lib/string.c 2005-10-31 13:04:50.000000000 -0800
+++ 2.6.14-slob/lib/string.c 2005-10-31 18:14:39.000000000 -0800
@@ -23,6 +23,7 @@
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/module.h>
+#include <linux/slab.h>
#ifndef __HAVE_ARCH_STRNICMP
/**
@@ -602,3 +603,25 @@ void *memchr(const void *s, int c, size_
}
EXPORT_SYMBOL(memchr);
#endif
+
+/*
+ * kstrdup - allocate space for and copy an existing string
+ *
+ * @s: the string to duplicate
+ * @gfp: the GFP mask used in the kmalloc() call when allocating memory
+ */
+char *kstrdup(const char *s, gfp_t gfp)
+{
+ size_t len;
+ char *buf;
+
+ if (!s)
+ return NULL;
+
+ len = strlen(s) + 1;
+ buf = kmalloc(len, gfp);
+ if (buf)
+ memcpy(buf, s, len);
+ return buf;
+}
+EXPORT_SYMBOL(kstrdup);
Index: 2.6.14-slob/mm/slab.c
===================================================================
--- 2.6.14-slob.orig/mm/slab.c 2005-10-31 13:04:50.000000000 -0800
+++ 2.6.14-slob/mm/slab.c 2005-10-31 18:14:43.000000000 -0800
@@ -3596,26 +3596,3 @@ unsigned int ksize(const void *objp)
return obj_reallen(GET_PAGE_CACHE(virt_to_page(objp)));
}
-
-
-/*
- * kstrdup - allocate space for and copy an existing string
- *
- * @s: the string to duplicate
- * @gfp: the GFP mask used in the kmalloc() call when allocating memory
- */
-char *kstrdup(const char *s, gfp_t gfp)
-{
- size_t len;
- char *buf;
-
- if (!s)
- return NULL;
-
- len = strlen(s) + 1;
- buf = kmalloc(len, gfp);
- if (buf)
- memcpy(buf, s, len);
- return buf;
-}
-EXPORT_SYMBOL(kstrdup);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]