added qemu_strdup()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1021 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/osdep.c b/osdep.c
index 83f5a77..76bfa26 100644
--- a/osdep.c
+++ b/osdep.c
@@ -294,6 +294,16 @@
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 1c14de4..dfe80bc 100644
--- a/osdep.h
+++ b/osdep.h
@@ -10,6 +10,7 @@
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);