]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Added strdup()
authorMichael Brown <mcb30@etherboot.org>
Fri, 8 Dec 2006 00:34:47 +0000 (00:34 +0000)
committerMichael Brown <mcb30@etherboot.org>
Fri, 8 Dec 2006 00:34:47 +0000 (00:34 +0000)
src/core/string.c
src/include/string.h

index 856f955b64b414221841beeb83b7c8c62d2e0f0c..da35e208b7f29ee3cf2adbb5e471f73bea8fa3d8 100644 (file)
@@ -21,8 +21,9 @@
  *    reentrant and should be faster). Use only strsep() in new code, please.
  */
  
-#include "etherboot.h"
-
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
 
 /* *** FROM string.c *** */
 
@@ -538,3 +539,10 @@ void * memchr(const void *s, int c, size_t n)
 }
 
 #endif
+
+char * strdup(const char *s) {
+       char *new = malloc(strlen(s)+1);
+       if (new)
+               strcpy(new,s);
+       return new;
+}
index 8ada05a0fbdc95a215f66136f76aa4cfd8d265d8..a6f3e71b9de7aa4ed6c050c1c68bea2f20f9d760 100644 (file)
@@ -66,5 +66,6 @@ int __attribute__ (( pure )) memcmp(const void * cs,const void * ct,
 void * memscan(void * addr, int c, size_t size);
 char * strstr(const char * s1,const char * s2);
 void * memchr(const void *s, int c, size_t n);
+char * strdup(const char *s);
 
 #endif /* ETHERBOOT_STRING */