Skip to content

Commit

Permalink
added qemu_strdup()
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1021 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
bellard committed Jul 14, 2004
1 parent 81d0912 commit 2571929
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions osdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
1 change: 1 addition & 0 deletions osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2571929

Please sign in to comment.