Commit 2571929a77c2d1c77c9fd28341994eb69acda7b6
1 parent
81d0912d
added qemu_strdup()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1021 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
11 additions
and
0 deletions
osdep.c
... | ... | @@ -294,6 +294,16 @@ void *qemu_mallocz(size_t size) |
294 | 294 | return ptr; |
295 | 295 | } |
296 | 296 | |
297 | +char *qemu_strdup(const char *str) | |
298 | +{ | |
299 | + char *ptr; | |
300 | + ptr = qemu_malloc(strlen(str) + 1); | |
301 | + if (!ptr) | |
302 | + return NULL; | |
303 | + strcpy(ptr, str); | |
304 | + return ptr; | |
305 | +} | |
306 | + | |
297 | 307 | /****************************************************************/ |
298 | 308 | /* printf support */ |
299 | 309 | ... | ... |
osdep.h