aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osdep.c10
-rw-r--r--osdep.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/osdep.c b/osdep.c
index 83f5a77ccc..76bfa2663f 100644
--- a/osdep.c
+++ b/osdep.c
@@ -294,6 +294,16 @@ void *qemu_mallocz(size_t size)
return ptr;
}
+char *qemu_strdup(const char *str)
+{
+ char *ptr;
+ ptr = qemu_malloc(strlen(str) + 1);
+ if (!ptr)
+ return NULL;
+ strcpy(ptr, str);
+ return ptr;
+}
+
/****************************************************************/
/* printf support */
diff --git a/osdep.h b/osdep.h
index 1c14de4c5e..dfe80bcf98 100644
--- a/osdep.h
+++ b/osdep.h
@@ -10,6 +10,7 @@ void qemu_printf(const char *fmt, ...);
void *qemu_malloc(size_t size);
void *qemu_mallocz(size_t size);
void qemu_free(void *ptr);
+char *qemu_strdup(const char *str);
void *get_mmap_addr(unsigned long size);