diff options
Diffstat (limited to 'tools/lib/string.c')
-rw-r--r-- | tools/lib/string.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/lib/string.c b/tools/lib/string.c new file mode 100644 index 000000000000..ecfd43a9b24e --- /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; +} |