summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/lib/string.c b/tools/lib/string.c
new file mode 100644
index 0000000..ecfd43a
--- /dev/null
+++ b/tools/lib/string.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include <string.h>
+#include <linux/string.h>
+
+/**
+ * memdup - duplicate region of memory
+ *
+ * @src: memory region to duplicate
+ * @len: memory region length
+ */
+void *memdup(const void *src, size_t len)
+{
+ void *p = malloc(len);
+
+ if (p)
+ memcpy(p, src, len);
+
+ return p;
+}
OpenPOWER on IntegriCloud