summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2014-09-05 15:12:20 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-09-22 13:30:18 -0500
commitc7187ce599df0f6ff1e516b94aa22312dc43e179 (patch)
tree01d7962108a0b1b1afe2f53b3e0e3601e6f13b4b /src/lib
parent372fd2a64a4a45e98bd50f9041d3874e0fee2341 (diff)
downloadtalos-hostboot-c7187ce599df0f6ff1e516b94aa22312dc43e179.tar.gz
talos-hostboot-c7187ce599df0f6ff1e516b94aa22312dc43e179.zip
Add strdup.
Change-Id: Ib136e5f4200e6cb439c3bbef83de94229f2dbebe Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13248 Tested-by: Jenkins Server Reviewed-by: Brian Silver <bsilver@us.ibm.com> Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/string.C10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/string.C b/src/lib/string.C
index 7a4d1df6f..9acc418e7 100644
--- a/src/lib/string.C
+++ b/src/lib/string.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -21,6 +23,7 @@
/* */
/* IBM_PROLOG_END_TAG */
#include <string.h>
+#include <stdlib.h>
extern "C" void *memset(void *vdest, int ch, size_t len)
{
@@ -281,3 +284,8 @@ extern "C" char* strchr(const char* s, int c)
if (*s == c) return (char*)s;
return NULL;
}
+
+char* strdup(const char* s)
+{
+ return strcpy(static_cast<char*>(malloc(strlen(s)+1)), s);
+}
OpenPOWER on IntegriCloud