summaryrefslogtreecommitdiff
path: root/com32/lib/lstrdup.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-24 11:56:43 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-24 11:56:43 -0800
commitf3c1e08946a59b1aae2536436ea9384eafe3ad10 (patch)
treee56831cc52171c5ace1449e12f09a35f8662b800 /com32/lib/lstrdup.c
parenta2656772d030444ee1e2bdd289d3726edcf2d741 (diff)
downloadsyslinux-f3c1e08946a59b1aae2536436ea9384eafe3ad10.tar.gz
com32: wrapper functions for lowmem allocations
lmalloc(), lfree(), lstrdup() Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/lib/lstrdup.c')
-rw-r--r--com32/lib/lstrdup.c18
1 files changed, 18 insertions, 0 deletions
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 <string.h>
+#include <stdlib.h>
+#include <com32.h>
+
+char *lstrdup(const char *s)
+{
+ int l = strlen(s) + 1;
+ char *d = lmalloc(l);
+
+ if (d)
+ memcpy(d, s, l);
+
+ return d;
+}