2009-12-07 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Check for vasprintf. * util/misc.c (asprintf): Move allocation from here ... (vasprintf): ... to here. New function. (xasprintf): New function. * include/grub/util/misc.h (vasprintf, xasprintf): Add prototypes. * util/getroot.c (grub_util_get_grub_dev): Use xasprintf. * util/grub-mkfont.c (write_font): Likewise. * util/grub-probe.c (probe): Likewise. * util/hostdisk.c (make_device_name): Likewise.
This commit is contained in:
parent
de6daa8b56
commit
d6ceebf1d9
9 changed files with 68 additions and 18 deletions
|
@ -679,14 +679,14 @@ make_device_name (int drive, int dos_part, int bsd_part)
|
|||
char *bsd_part_str = NULL;
|
||||
|
||||
if (dos_part >= 0)
|
||||
asprintf (&dos_part_str, ",%d", dos_part + 1);
|
||||
dos_part_str = xasprintf (",%d", dos_part + 1);
|
||||
|
||||
if (bsd_part >= 0)
|
||||
asprintf (&bsd_part_str, ",%c", dos_part + 'a');
|
||||
bsd_part_str = xasprintf (",%c", dos_part + 'a');
|
||||
|
||||
asprintf (&ret, "%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
ret = xasprintf ("%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
|
||||
if (dos_part_str)
|
||||
free (dos_part_str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue