diff --git a/commands/hashsum.c b/commands/hashsum.c index a098ab7af..a4e71b844 100644 --- a/commands/hashsum.c +++ b/commands/hashsum.c @@ -111,7 +111,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename, { char *filename; - filename = grub_asprintf ("%s/%s", prefix, p); + filename = grub_xasprintf ("%s/%s", prefix, p); if (!filename) return grub_errno; file = grub_file_open (filename); diff --git a/commands/help.c b/commands/help.c index a19b395cd..1181c3bfb 100644 --- a/commands/help.c +++ b/commands/help.c @@ -47,7 +47,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc, grub_uint32_t *unicode_command_help; grub_uint32_t *unicode_last_position; - command_help = grub_asprintf ("%s %s", cmd->name, summary_translated); + command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated); if (!command_help) return 1; diff --git a/commands/ls.c b/commands/ls.c index cfa46ec6e..8a8319ac8 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -97,9 +97,9 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human) grub_file_t file; if (dirname[grub_strlen (dirname) - 1] == '/') - pathname = grub_asprintf ("%s%s", dirname, filename); + pathname = grub_xasprintf ("%s%s", dirname, filename); else - pathname = grub_asprintf ("%s/%s", dirname, filename); + pathname = grub_xasprintf ("%s/%s", dirname, filename); if (!pathname) return 1; diff --git a/commands/parttool.c b/commands/parttool.c index 3bffb8eb0..5ad6133ca 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -183,7 +183,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), { char *filename; - filename = grub_asprintf ("%s/parttool.lst", prefix); + filename = grub_xasprintf ("%s/parttool.lst", prefix); if (filename) { grub_file_t file; diff --git a/commands/search.c b/commands/search.c index 51b7794fc..afb2e98e8 100644 --- a/commands/search.c +++ b/commands/search.c @@ -50,7 +50,7 @@ FUNC_NAME (const char *key, const char *var, int no_floppy) char *buf; grub_file_t file; - buf = grub_asprintf ("(%s)%s", name, key); + buf = grub_xasprintf ("(%s)%s", name, key); if (! buf) return 1; diff --git a/disk/efi/efidisk.c b/disk/efi/efidisk.c index 0b5731c0f..58300a0d2 100644 --- a/disk/efi/efidisk.c +++ b/disk/efi/efidisk.c @@ -805,7 +805,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle) return 0; } - device_name = grub_asprintf ("%s,%s", parent->name, partition_name); + device_name = grub_xasprintf ("%s,%s", parent->name, partition_name); grub_free (partition_name); grub_disk_close (parent); diff --git a/disk/raid.c b/disk/raid.c index 3d25c1747..2d544afdc 100644 --- a/disk/raid.c +++ b/disk/raid.c @@ -556,7 +556,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array, } } - array->name = grub_asprintf ("md%d", array->number); + array->name = grub_xasprintf ("md%d", array->number); if (! array->name) { grub_free (array->uuid); diff --git a/disk/scsi.c b/disk/scsi.c index 2afdc1a15..6f3233b29 100644 --- a/disk/scsi.c +++ b/disk/scsi.c @@ -208,7 +208,7 @@ grub_scsi_iterate (int (*hook) (const char *name)) for (i = 0; i < luns; i++) { char *sname; - sname = grub_asprintf ("%s%c", name, 'a' + i); + sname = grub_xasprintf ("%s%c", name, 'a' + i); if (!sname) return 1; if (hook (sname)) diff --git a/disk/usbms.c b/disk/usbms.c index 708168e81..8554b224f 100644 --- a/disk/usbms.c +++ b/disk/usbms.c @@ -201,7 +201,7 @@ grub_usbms_iterate (int (*hook) (const char *name, int luns)) for (p = grub_usbms_dev_list; p; p = p->next) { char *devname; - devname = grub_asprintf ("usb%d", cnt); + devname = grub_xasprintf ("usb%d", cnt); if (hook (devname, p->luns)) { diff --git a/efiemu/main.c b/efiemu/main.c index 70a12080f..9480bfc4d 100644 --- a/efiemu/main.c +++ b/efiemu/main.c @@ -255,7 +255,7 @@ grub_efiemu_autocore (void) suffix = grub_efiemu_get_default_core_name (); - filename = grub_asprintf ("%s/%s", prefix, suffix); + filename = grub_xasprintf ("%s/%s", prefix, suffix); if (! filename) return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't allocate temporary space"); diff --git a/fs/ext2.c b/fs/ext2.c index 4339b981b..ac36b329b 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -875,7 +875,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid) data = grub_ext2_mount (disk); if (data) { - *uuid = grub_asprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[2]), diff --git a/fs/fat.c b/fs/fat.c index a0a40cfab..d008dc10d 100644 --- a/fs/fat.c +++ b/fs/fat.c @@ -833,7 +833,7 @@ grub_fat_uuid (grub_device_t device, char **uuid) data = grub_fat_mount (disk); if (data) { - *uuid = grub_asprintf ("%04x-%04x", + *uuid = grub_xasprintf ("%04x-%04x", (grub_uint16_t) (data->uuid >> 16), (grub_uint16_t) data->uuid); } diff --git a/fs/hfs.c b/fs/hfs.c index 701b09468..cef856326 100644 --- a/fs/hfs.c +++ b/fs/hfs.c @@ -1082,7 +1082,7 @@ grub_hfs_uuid (grub_device_t device, char **uuid) data = grub_hfs_mount (device->disk); if (data && data->sblock.num_serial != 0) { - *uuid = grub_asprintf ("%016llx", + *uuid = grub_xasprintf ("%016llx", (unsigned long long) grub_be_to_cpu64 (data->sblock.num_serial)); } diff --git a/fs/hfsplus.c b/fs/hfsplus.c index 6556bedaa..bcb8e9584 100644 --- a/fs/hfsplus.c +++ b/fs/hfsplus.c @@ -995,7 +995,7 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid) data = grub_hfsplus_mount (disk); if (data) { - *uuid = grub_asprintf ("%016llx", + *uuid = grub_xasprintf ("%016llx", (unsigned long long) grub_be_to_cpu64 (data->volheader.num_serial)); } diff --git a/fs/i386/pc/pxe.c b/fs/i386/pc/pxe.c index 60a49fc53..8bfe17594 100644 --- a/fs/i386/pc/pxe.c +++ b/fs/i386/pc/pxe.c @@ -501,7 +501,7 @@ write_ip_env (grub_uint32_t *ip, const char *val) return 0; /* Normalize the IP. */ - buf = grub_asprintf ("%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff, + buf = grub_xasprintf ("%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff, (newip >> 16) & 0xff, (newip >> 24) & 0xff); if (!buf) return 0; @@ -543,7 +543,7 @@ grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)), else if (size > GRUB_PXE_MAX_BLKSIZE) size = GRUB_PXE_MAX_BLKSIZE; - buf = grub_asprintf ("%d", size); + buf = grub_xasprintf ("%d", size); if (!buf) return 0; @@ -560,7 +560,7 @@ GRUB_MOD_INIT(pxe) { char *buf; - buf = grub_asprintf ("%d", grub_pxe_blksize); + buf = grub_xasprintf ("%d", grub_pxe_blksize); if (buf) grub_env_set ("net_pxe_blksize", buf); grub_free (buf); diff --git a/fs/iso9660.c b/fs/iso9660.c index 928e1f984..a8a310f50 100644 --- a/fs/iso9660.c +++ b/fs/iso9660.c @@ -840,7 +840,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid) } else { - *uuid = grub_asprintf ("%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c", + *uuid = grub_xasprintf ("%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c", data->voldesc.modified.year[0], data->voldesc.modified.year[1], data->voldesc.modified.year[2], diff --git a/fs/jfs.c b/fs/jfs.c index 1bc3c7758..c9839a22f 100644 --- a/fs/jfs.c +++ b/fs/jfs.c @@ -842,7 +842,7 @@ grub_jfs_uuid (grub_device_t device, char **uuid) data = grub_jfs_mount (disk); if (data) { - *uuid = grub_asprintf ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + *uuid = grub_xasprintf ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" "%02x%02x%02x%02x%02x%02x", data->sblock.uuid[0], data->sblock.uuid[1], data->sblock.uuid[2], data->sblock.uuid[3], diff --git a/fs/ntfs.c b/fs/ntfs.c index 63c1eeb82..dd041e23a 100644 --- a/fs/ntfs.c +++ b/fs/ntfs.c @@ -1072,7 +1072,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid) data = grub_ntfs_mount (disk); if (data) { - *uuid = grub_asprintf ("%016llx", (unsigned long long) data->uuid); + *uuid = grub_xasprintf ("%016llx", (unsigned long long) data->uuid); } else *uuid = NULL; diff --git a/fs/reiserfs.c b/fs/reiserfs.c index d5a20ee6c..444bf3120 100644 --- a/fs/reiserfs.c +++ b/fs/reiserfs.c @@ -1335,7 +1335,7 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid) data = grub_reiserfs_mount (disk); if (data) { - *uuid = grub_asprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", grub_be_to_cpu16 (data->superblock.uuid[0]), grub_be_to_cpu16 (data->superblock.uuid[1]), grub_be_to_cpu16 (data->superblock.uuid[2]), diff --git a/fs/ufs.c b/fs/ufs.c index e8d48852b..40cf068e6 100644 --- a/fs/ufs.c +++ b/fs/ufs.c @@ -732,7 +732,7 @@ grub_ufs_uuid (grub_device_t device, char **uuid) data = grub_ufs_mount (disk); if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0)) - *uuid = grub_asprintf ("%08x%08x", + *uuid = grub_xasprintf ("%08x%08x", (unsigned) grub_le_to_cpu32 (data->sblock.uuidhi), (unsigned) grub_le_to_cpu32 (data->sblock.uuidlow)); else diff --git a/fs/xfs.c b/fs/xfs.c index 309460b61..9dffe31d1 100644 --- a/fs/xfs.c +++ b/fs/xfs.c @@ -777,7 +777,7 @@ grub_xfs_uuid (grub_device_t device, char **uuid) data = grub_xfs_mount (disk); if (data) { - *uuid = grub_asprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", + *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", grub_be_to_cpu16 (data->sblock.uuid[0]), grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[2]), diff --git a/gettext/gettext.c b/gettext/gettext.c index e835b0e1a..9a1756be7 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -286,7 +286,7 @@ grub_gettext_init_ext (const char *lang) /* Warning: if changing some paths in the below line, change the grub_malloc contents below. */ - mo_file = grub_asprintf ("%s/%s.mo", locale_dir, lang); + mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, lang); if (!mo_file) return; @@ -296,7 +296,7 @@ grub_gettext_init_ext (const char *lang) if (fd_mo == NULL) { grub_free (mo_file); - mo_file = grub_asprintf ("%s.gz", mo_file); + mo_file = grub_xasprintf ("%s.gz", mo_file); if (!mo_file) return; fd_mo = grub_mofile_open (mo_file); diff --git a/include/grub/misc.h b/include/grub/misc.h index 2c1817492..221734a22 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -199,9 +199,9 @@ int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, va_list args); -char *EXPORT_FUNC(grub_asprintf) (const char *fmt, ...) +char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); -char *EXPORT_FUNC(grub_avsprintf) (const char *fmt, va_list args); +char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args); void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn)); void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn)); grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest, diff --git a/kern/device.c b/kern/device.c index 3727ddcd9..5cfd190f3 100644 --- a/kern/device.c +++ b/kern/device.c @@ -146,7 +146,7 @@ grub_device_iterate (int (*hook) (const char *name)) return 1; } - p->name = grub_asprintf ("%s,%s", disk->name, partition_name); + p->name = grub_xasprintf ("%s,%s", disk->name, partition_name); if (!p->name) { grub_free (partition_name); diff --git a/kern/dl.c b/kern/dl.c index ce134a34f..4735a004a 100644 --- a/kern/dl.c +++ b/kern/dl.c @@ -627,7 +627,7 @@ grub_dl_load (const char *name) return 0; } - filename = grub_asprintf ("%s/%s.mod", grub_dl_dir, name); + filename = grub_xasprintf ("%s/%s.mod", grub_dl_dir, name); if (! filename) return 0; diff --git a/kern/efi/init.c b/kern/efi/init.c index 7f5f4ddd2..a0b4ff779 100644 --- a/kern/efi/init.c +++ b/kern/efi/init.c @@ -63,7 +63,7 @@ grub_efi_set_prefix (void) if (p) *p = '\0'; - prefix = grub_asprintf ("(%s)%s", device, file); + prefix = grub_xasprintf ("(%s)%s", device, file); if (prefix) { diff --git a/kern/env.c b/kern/env.c index 49a8db362..cebb4eeff 100644 --- a/kern/env.c +++ b/kern/env.c @@ -357,7 +357,7 @@ grub_register_variable_hook (const char *name, static char * mangle_data_slot_name (const char *name) { - return grub_asprintf ("\e%s", name); + return grub_xasprintf ("\e%s", name); } grub_err_t diff --git a/kern/ieee1275/init.c b/kern/ieee1275/init.c index b09623f1b..04e4e2dca 100644 --- a/kern/ieee1275/init.c +++ b/kern/ieee1275/init.c @@ -111,7 +111,7 @@ grub_machine_set_prefix (void) *lastslash = '\0'; grub_translate_ieee1275_path (filename); - newprefix = grub_asprintf ("%s%s", prefix, filename); + newprefix = grub_xasprintf ("%s%s", prefix, filename); if (newprefix) { grub_free (prefix); diff --git a/kern/ieee1275/openfw.c b/kern/ieee1275/openfw.c index 50bd9557a..5f0aad119 100644 --- a/kern/ieee1275/openfw.c +++ b/kern/ieee1275/openfw.c @@ -82,7 +82,7 @@ grub_children_iterate (char *devpath, IEEE1275_MAX_PROP_LEN, &actual)) continue; - fullname = grub_asprintf ("%s/%s", devpath, childname); + fullname = grub_xasprintf ("%s/%s", devpath, childname); if (!fullname) { grub_free (childname); @@ -332,7 +332,7 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype) /* Make sure filepath has leading backslash. */ if (filepath[0] != '\\') - ret = grub_asprintf ("\\%s", filepath); + ret = grub_xasprintf ("\\%s", filepath); else ret = grub_strdup (filepath); } @@ -382,10 +382,10 @@ grub_ieee1275_encode_devname (const char *path) /* GRUB partition 1 is OF partition 0. */ partno++; - encoding = grub_asprintf ("(%s,%d)", device, partno); + encoding = grub_xasprintf ("(%s,%d)", device, partno); } else - encoding = grub_asprintf ("(%s)", device); + encoding = grub_xasprintf ("(%s)", device); grub_free (partition); grub_free (device); diff --git a/kern/misc.c b/kern/misc.c index b1446de5c..ba31d24bb 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -913,7 +913,7 @@ grub_snprintf (char *str, grub_size_t n, const char *fmt, ...) #define PREALLOC_SIZE 255 char * -grub_avsprintf (const char *fmt, va_list ap) +grub_xvasprintf (const char *fmt, va_list ap) { grub_size_t s, as = PREALLOC_SIZE; char *ret; @@ -934,13 +934,13 @@ grub_avsprintf (const char *fmt, va_list ap) } char * -grub_asprintf (const char *fmt, ...) +grub_xasprintf (const char *fmt, ...) { va_list ap; char *ret; va_start (ap, fmt); - ret = grub_avsprintf (fmt, ap); + ret = grub_xvasprintf (fmt, ap); va_end (ap); return ret; diff --git a/kern/sparc64/ieee1275/init.c b/kern/sparc64/ieee1275/init.c index 339d836a3..115328f40 100644 --- a/kern/sparc64/ieee1275/init.c +++ b/kern/sparc64/ieee1275/init.c @@ -90,7 +90,7 @@ grub_machine_set_prefix (void) } prefix = grub_ieee1275_encode_devname (bootpath); - path = grub_asprintf("%s%s", prefix, grub_prefix); + path = grub_xasprintf("%s%s", prefix, grub_prefix); grub_strcpy (grub_prefix, path); diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index 7215c4e82..2598371b7 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -1150,7 +1150,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)), if (*p == '"') p++; - name = grub_asprintf ("kFreeBSD.%s", curr); + name = grub_xasprintf ("kFreeBSD.%s", curr); if (!name) goto fail; if (grub_env_set (name, p)) diff --git a/loader/i386/linux.c b/loader/i386/linux.c index c764dad25..5d9edbe7d 100644 --- a/loader/i386/linux.c +++ b/loader/i386/linux.c @@ -519,7 +519,7 @@ grub_linux_boot (void) May change in future if we have modes without framebuffer. */ if (modevar && *modevar != 0) { - tmp = grub_asprintf ("%s;text", modevar); + tmp = grub_xasprintf ("%s;text", modevar); if (! tmp) return grub_errno; err = grub_video_set_mode (tmp, 0, 0); @@ -797,7 +797,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), linux_mode = &linux_vesafb_modes[vid_mode - GRUB_LINUX_VID_MODE_VESA_START]; - buf = grub_asprintf ("%ux%ux%u,%ux%u", + buf = grub_xasprintf ("%ux%ux%u,%ux%u", linux_vesafb_res[linux_mode->res_index].width, linux_vesafb_res[linux_mode->res_index].height, linux_mode->depth, diff --git a/loader/i386/multiboot.c b/loader/i386/multiboot.c index 16c19b6d1..fc9588269 100644 --- a/loader/i386/multiboot.c +++ b/loader/i386/multiboot.c @@ -252,11 +252,11 @@ grub_multiboot (int argc, char *argv[]) { char *buf; if (header->depth && header->width && header->height) - buf = grub_asprintf ("%dx%dx%d,%dx%d,auto", header->width, + buf = grub_xasprintf ("%dx%dx%d,%dx%d,auto", header->width, header->height, header->depth, header->width, header->height); else if (header->width && header->height) - buf = grub_asprintf ("%dx%d,auto", header->width, header->height); + buf = grub_xasprintf ("%dx%d,auto", header->width, header->height); else buf = grub_strdup ("auto"); diff --git a/loader/i386/multiboot_mbi.c b/loader/i386/multiboot_mbi.c index 4493c03c7..a154d1b23 100644 --- a/loader/i386/multiboot_mbi.c +++ b/loader/i386/multiboot_mbi.c @@ -150,7 +150,7 @@ set_video_mode (void) else { char *tmp; - tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); + tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); if (! tmp) return grub_errno; err = grub_video_set_mode (tmp, 0, 0); diff --git a/loader/i386/pc/xnu.c b/loader/i386/pc/xnu.c index 1c8b1ddec..c683dd0f9 100644 --- a/loader/i386/pc/xnu.c +++ b/loader/i386/pc/xnu.c @@ -47,7 +47,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params) 32 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS); else { - tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); + tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); if (! tmp) return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't allocate temporary storag"); diff --git a/loader/xnu.c b/loader/xnu.c index 30ce95b3f..e0a2dfe8b 100644 --- a/loader/xnu.c +++ b/loader/xnu.c @@ -569,7 +569,7 @@ grub_xnu_register_memory (char *prefix, int *suffix, return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory"); if (suffix) { - driverkey->name = grub_asprintf ("%s%d", prefix, (*suffix)++); + driverkey->name = grub_xasprintf ("%s%d", prefix, (*suffix)++); if (!driverkey->name) return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory"); } diff --git a/normal/autofs.c b/normal/autofs.c index 94c08c59e..57e43fdf4 100644 --- a/normal/autofs.c +++ b/normal/autofs.c @@ -57,7 +57,7 @@ read_fs_list (void) { char *filename; - filename = grub_asprintf ("%s/fs.lst", prefix); + filename = grub_xasprintf ("%s/fs.lst", prefix); if (filename) { grub_file_t file; diff --git a/normal/completion.c b/normal/completion.c index aed4c4787..13e8f7a6b 100644 --- a/normal/completion.c +++ b/normal/completion.c @@ -107,7 +107,7 @@ iterate_partition (grub_disk_t disk, const grub_partition_t p) if (! partition_name) return 1; - name = grub_asprintf ("%s,%s", disk_name, partition_name); + name = grub_xasprintf ("%s,%s", disk_name, partition_name); grub_free (partition_name); if (! name) @@ -138,7 +138,7 @@ iterate_dir (const char *filename, const struct grub_dirhook_info *info) { char *fname; - fname = grub_asprintf ("%s/", filename); + fname = grub_xasprintf ("%s/", filename); if (add_completion (fname, "", GRUB_COMPLETION_TYPE_FILE)) { grub_free (fname); @@ -359,7 +359,7 @@ complete_arguments (char *command) if (!option->longarg) continue; - longarg = grub_asprintf ("--%s", option->longarg); + longarg = grub_xasprintf ("--%s", option->longarg); if (!longarg) return 1; diff --git a/normal/crypto.c b/normal/crypto.c index 7ca0de900..932f26f97 100644 --- a/normal/crypto.c +++ b/normal/crypto.c @@ -80,7 +80,7 @@ read_crypto_list (void) return; } - filename = grub_asprintf ("%s/crypto.lst", prefix); + filename = grub_xasprintf ("%s/crypto.lst", prefix); if (!filename) { grub_errno = GRUB_ERR_NONE; diff --git a/normal/dyncmd.c b/normal/dyncmd.c index 8f324626c..ca9a82289 100644 --- a/normal/dyncmd.c +++ b/normal/dyncmd.c @@ -69,7 +69,7 @@ read_command_list (void) { char *filename; - filename = grub_asprintf ("%s/command.lst", prefix); + filename = grub_xasprintf ("%s/command.lst", prefix); if (filename) { grub_file_t file; diff --git a/normal/handler.c b/normal/handler.c index 034be77d1..686626929 100644 --- a/normal/handler.c +++ b/normal/handler.c @@ -172,7 +172,7 @@ read_handler_list (void) { char *filename; - filename = grub_asprintf ("%s/handler.lst", prefix); + filename = grub_xasprintf ("%s/handler.lst", prefix); if (filename) { grub_file_t file; diff --git a/normal/main.c b/normal/main.c index 0c192712f..6e3518a59 100644 --- a/normal/main.c +++ b/normal/main.c @@ -412,7 +412,7 @@ grub_normal_init_page (struct grub_term_output *term) grub_term_cls (term); - msg_formatted = grub_asprintf (msg, PACKAGE_VERSION); + msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION); if (!msg_formatted) return; @@ -502,7 +502,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), prefix = grub_env_get ("prefix"); if (prefix) { - config = grub_asprintf ("%s/grub.cfg", prefix); + config = grub_xasprintf ("%s/grub.cfg", prefix); if (! config) goto quit; @@ -541,7 +541,7 @@ grub_normal_reader_init (int nested) const char *msg_esc = _("ESC at any time exits."); char *msg_formatted; - msg_formatted = grub_asprintf (msg, nested ? msg_esc : ""); + msg_formatted = grub_xasprintf (msg, nested ? msg_esc : ""); if (!msg_formatted) return grub_errno; @@ -566,9 +566,9 @@ grub_normal_read_line_real (char **line, int cont, int nested) char *prompt; if (cont) - prompt = grub_asprintf (">"); + prompt = grub_xasprintf (">"); else - prompt = grub_asprintf ("%s>", parser->name); + prompt = grub_xasprintf ("%s>", parser->name); if (!prompt) return grub_errno; diff --git a/normal/menu_text.c b/normal/menu_text.c index f7a1358f4..b39f57512 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -187,7 +187,7 @@ command-line or ESC to return menu."), STANDARD_MARGIN, STANDARD_MARGIN, "entry is highlighted.\n"); char *msg_translated; - msg_translated = grub_asprintf (msg, (grub_uint32_t) GRUB_TERM_DISP_UP, + msg_translated = grub_xasprintf (msg, (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN); if (!msg_translated) return; @@ -367,7 +367,7 @@ menu_text_print_timeout (int timeout, void *dataptr) grub_term_gotoxy (data->term, 0, grub_term_height (data->term) - 3); - msg_translated = grub_asprintf (msg, timeout); + msg_translated = grub_xasprintf (msg, timeout); if (!msg_translated) { grub_print_error (); diff --git a/normal/term.c b/normal/term.c index 86902c7a1..42201fbb3 100644 --- a/normal/term.c +++ b/normal/term.c @@ -167,7 +167,7 @@ read_terminal_list (void) return; } - filename = grub_asprintf ("%s/terminal.lst", prefix); + filename = grub_xasprintf ("%s/terminal.lst", prefix); if (!filename) { grub_errno = GRUB_ERR_NONE; diff --git a/partmap/acorn.c b/partmap/acorn.c index aead5ff85..081b6ee94 100644 --- a/partmap/acorn.c +++ b/partmap/acorn.c @@ -175,7 +175,7 @@ fail: static char * acorn_partition_map_get_name (const grub_partition_t p) { - return grub_asprintf ("%d", p->index + 1); + return grub_xasprintf ("%d", p->index + 1); } diff --git a/partmap/amiga.c b/partmap/amiga.c index 691bd4c3e..f832db354 100644 --- a/partmap/amiga.c +++ b/partmap/amiga.c @@ -184,7 +184,7 @@ amiga_partition_map_probe (grub_disk_t disk, const char *str) static char * amiga_partition_map_get_name (const grub_partition_t p) { - return grub_asprintf ("%d", p->index + 1); + return grub_xasprintf ("%d", p->index + 1); } diff --git a/partmap/apple.c b/partmap/apple.c index 18dbef586..a1a645acf 100644 --- a/partmap/apple.c +++ b/partmap/apple.c @@ -227,7 +227,7 @@ apple_partition_map_probe (grub_disk_t disk, const char *str) static char * apple_partition_map_get_name (const grub_partition_t p) { - return grub_asprintf ("%d", p->index + 1); + return grub_xasprintf ("%d", p->index + 1); } diff --git a/partmap/gpt.c b/partmap/gpt.c index ed583e0a3..cb1229bee 100644 --- a/partmap/gpt.c +++ b/partmap/gpt.c @@ -162,7 +162,7 @@ gpt_partition_map_probe (grub_disk_t disk, const char *str) static char * gpt_partition_map_get_name (const grub_partition_t p) { - return grub_asprintf ("%d", p->index + 1); + return grub_xasprintf ("%d", p->index + 1); } diff --git a/partmap/msdos.c b/partmap/msdos.c index ea3266605..1c3861cc7 100644 --- a/partmap/msdos.c +++ b/partmap/msdos.c @@ -303,11 +303,11 @@ pc_partition_map_get_name (const grub_partition_t p) struct grub_msdos_partition *pcdata = p->data; if (pcdata->bsd_part < 0) - return grub_asprintf ("%d", pcdata->dos_part + 1); + return grub_xasprintf ("%d", pcdata->dos_part + 1); else if (pcdata->dos_part < 0) - return grub_asprintf ("%c", pcdata->bsd_part + 'a'); + return grub_xasprintf ("%c", pcdata->bsd_part + 'a'); else - return grub_asprintf ("%d,%c", pcdata->dos_part + 1, + return grub_xasprintf ("%d,%c", pcdata->dos_part + 1, pcdata->bsd_part + 'a'); } diff --git a/partmap/sun.c b/partmap/sun.c index 89d0c5303..42cf0d598 100644 --- a/partmap/sun.c +++ b/partmap/sun.c @@ -184,7 +184,7 @@ sun_partition_map_probe (grub_disk_t disk, const char *str) static char * sun_partition_map_get_name (const grub_partition_t p) { - return grub_asprintf ("%d", p->index + 1); + return grub_xasprintf ("%d", p->index + 1); } /* Partition map type. */ diff --git a/term/gfxterm.c b/term/gfxterm.c index 50752bf89..a8aca7820 100644 --- a/term/gfxterm.c +++ b/term/gfxterm.c @@ -270,7 +270,7 @@ grub_gfxterm_init (void) GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0); else { - tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); + tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); if (!tmp) return grub_errno; err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0); diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c index b6be80cbe..dd4270eff 100644 --- a/term/ieee1275/ofconsole.c +++ b/term/ieee1275/ofconsole.c @@ -128,7 +128,7 @@ grub_ofconsole_setcolorstate (grub_term_color_state state) return; } - setcol = grub_asprintf ("\e[3%dm\e[4%dm", fg, bg); + setcol = grub_xasprintf ("\e[3%dm\e[4%dm", fg, bg); if (setcol) grub_ofconsole_writeesc (setcol); grub_free (setcol); @@ -301,7 +301,7 @@ grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y) grub_curr_x = x; grub_curr_y = y; - s = grub_asprintf ("\e[%d;%dH", y + 1, x + 1); + s = grub_xasprintf ("\e[%d;%dH", y + 1, x + 1); if (s) grub_ofconsole_writeesc (s); grub_free (s); diff --git a/tests/lib/test.c b/tests/lib/test.c index a90a9972c..b5c054370 100644 --- a/tests/lib/test.c +++ b/tests/lib/test.c @@ -56,7 +56,7 @@ add_failure (const char *file, failure->file = grub_strdup (file ? : ""); failure->funp = grub_strdup (funp ? : ""); failure->line = line; - failure->message = grub_avsprintf (fmt, args); + failure->message = grub_xvasprintf (fmt, args); grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure)); } diff --git a/util/grub-fstest.c b/util/grub-fstest.c index e249920fe..bf30286a4 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -285,8 +285,8 @@ fstest (char **images, int num_disks, int cmd, int n, char **args) for (i = 0; i < num_disks; i++) { - loop_name = grub_asprintf ("loop%d", i); - host_file = grub_asprintf ("(host)%s", images[i]); + loop_name = grub_xasprintf ("loop%d", i); + host_file = grub_xasprintf ("(host)%s", images[i]); if (!loop_name || !host_file) { @@ -337,7 +337,7 @@ fstest (char **images, int num_disks, int cmd, int n, char **args) for (i = 0; i < num_disks; i++) { grub_free (loop_name); - loop_name = grub_asprintf ("loop%d", i); + loop_name = grub_xasprintf ("loop%d", i); if (!loop_name) { grub_free (host_file);