]> git.sur5r.net Git - cc65/commitdiff
New function xdup.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 9 Apr 2006 10:04:50 +0000 (10:04 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 9 Apr 2006 10:04:50 +0000 (10:04 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3723 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/common/xmalloc.c
src/common/xmalloc.h

index 2810a0b3229508041bd37f7d123c22c719c7e629..a50ad1653c830108f9daa7b5e471d9832853be87 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                          */
 /*                                                                          */
 /*                                                                          */
-/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/* (C) 2000-2006 Ullrich von Bassewitz                                       */
 /*               Römerstrasse 52                                             */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -35,7 +35,7 @@
 
 #include <stdlib.h>
 #include <string.h>
-           
+
 /* common */
 #include "abend.h"
 #include "debugflag.h"
@@ -120,4 +120,11 @@ char* xstrdup (const char* S)
 
 
 
+void* xdup (const void* Buf, size_t Size)
+/* Create a copy of Buf on the heap and return a pointer to it. */
+{
+    return memcpy (xmalloc (Size), Buf, Size);
+}
+
+
 
index e041b9b1f509709b3662d8aeb368ba6a7d4d4c7d..5482302ed47213ae337c7932df1ab92c589ae94a 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000    Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 2000-2006 Ullrich von Bassewitz                                       */
+/*               Römerstraße 52                                              */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -60,6 +60,9 @@ void xfree (void* Block);
 char* xstrdup (const char* S);
 /* Duplicate a string on the heap. The function checks for out of memory */
 
+void* xdup (const void* Buf, size_t Size);
+/* Create a copy of Buf on the heap and return a pointer to it. */
+
 
 
 /* End of xmalloc.h */