]> git.saurik.com Git - apple/libc.git/blobdiff - libdarwin/stdlib.c
Libc-1353.60.8.tar.gz
[apple/libc.git] / libdarwin / stdlib.c
index d5ba78698b1b4980e48171c6d3ca789e0afced8e..1c22fb31d57c4642545d5c8a38e93b324290756a 100644 (file)
@@ -158,3 +158,26 @@ realpath_np(os_fd_t fd, char buff[static PATH_MAX])
 
        return error;
 }
+
+errno_t
+memdup_np(void **_new, const void *src, size_t len)
+{
+       void *mynew = NULL;
+
+       mynew = malloc(len);
+       if (!mynew) {
+               return errno;
+       }
+
+       memcpy(mynew, src, len);
+       *_new = mynew;
+       return 0;
+}
+
+void *
+memdup2_np(const void *src, size_t len)
+{
+       void *_new = os_malloc(len);
+       memcpy(_new, src, len);
+       return _new;
+}