Replace non-portable asprintf by g_strdup_printf

g_strdup_printf already handles OOM errors, so some error handling in
QEMU code can be removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Stefan Weil 2013-01-16 18:37:23 +01:00 committed by Blue Swirl
parent 0e7a759293
commit e4ada48242
3 changed files with 9 additions and 17 deletions

View file

@ -47,10 +47,7 @@ static struct pathelem *new_entry(const char *root,
{
struct pathelem *new = malloc(sizeof(*new));
new->name = strdup(name);
if (asprintf(&new->pathname, "%s/%s", root, name) == -1) {
printf("Cannot allocate memory\n");
exit(1);
}
new->pathname = g_strdup_printf("%s/%s", root, name);
new->num_entries = 0;
return new;
}