summaryrefslogtreecommitdiff
path: root/src/xine-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-utils')
-rw-r--r--src/xine-utils/utils.c13
-rw-r--r--src/xine-utils/xineutils.h6
2 files changed, 19 insertions, 0 deletions
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index d9eb7fb3f..e6e997341 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -286,6 +286,19 @@ void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) {
return ptr;
}
+void *xine_memdup (const void *src, size_t length)
+{
+ void *dst = malloc (length);
+ return xine_fast_memcpy (dst, src, length);
+}
+
+void *xine_memdup0 (const void *src, size_t length)
+{
+ char *dst = xine_xmalloc (length + 1);
+ dst[length] = 0;
+ return xine_fast_memcpy (dst, src, length);
+}
+
#ifdef WIN32
/*
* Parse command line with Windows XP syntax and copy the command (argv[0]).
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 4ff87e87c..89c62676b 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -633,6 +633,12 @@ void *xine_xcalloc(size_t nmemb, size_t size) XINE_MALLOC XINE_PROTECTED;
void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) XINE_PROTECTED;
/*
+ * Copy blocks of memory.
+ */
+void *xine_memdup (const void *src, size_t length) XINE_MALLOC XINE_PROTECTED;
+void *xine_memdup0 (const void *src, size_t length) XINE_MALLOC XINE_PROTECTED;
+
+/*
* Get user home directory.
*/
const char *xine_get_homedir(void) XINE_PROTECTED;