From f3c1e08946a59b1aae2536436ea9384eafe3ad10 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 24 Feb 2010 11:56:43 -0800 Subject: com32: wrapper functions for lowmem allocations lmalloc(), lfree(), lstrdup() Signed-off-by: H. Peter Anvin --- com32/lib/lstrdup.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 com32/lib/lstrdup.c (limited to 'com32/lib/lstrdup.c') diff --git a/com32/lib/lstrdup.c b/com32/lib/lstrdup.c new file mode 100644 index 00000000..d11efe7e --- /dev/null +++ b/com32/lib/lstrdup.c @@ -0,0 +1,18 @@ +/* + * lstrdup.c + */ + +#include +#include +#include + +char *lstrdup(const char *s) +{ + int l = strlen(s) + 1; + char *d = lmalloc(l); + + if (d) + memcpy(d, s, l); + + return d; +} -- cgit v1.2.1