mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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:
parent
0e7a759293
commit
e4ada48242
3 changed files with 9 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue