Rename asprint into xasprintf and avsprintf into xvasprintf

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-20 09:12:47 +01:00
parent adb893f2ae
commit 61eb45eee7
55 changed files with 79 additions and 79 deletions

View file

@ -111,7 +111,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
{ {
char *filename; char *filename;
filename = grub_asprintf ("%s/%s", prefix, p); filename = grub_xasprintf ("%s/%s", prefix, p);
if (!filename) if (!filename)
return grub_errno; return grub_errno;
file = grub_file_open (filename); file = grub_file_open (filename);

View file

@ -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_command_help;
grub_uint32_t *unicode_last_position; 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) if (!command_help)
return 1; return 1;

View file

@ -97,9 +97,9 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
grub_file_t file; grub_file_t file;
if (dirname[grub_strlen (dirname) - 1] == '/') if (dirname[grub_strlen (dirname) - 1] == '/')
pathname = grub_asprintf ("%s%s", dirname, filename); pathname = grub_xasprintf ("%s%s", dirname, filename);
else else
pathname = grub_asprintf ("%s/%s", dirname, filename); pathname = grub_xasprintf ("%s/%s", dirname, filename);
if (!pathname) if (!pathname)
return 1; return 1;

View file

@ -183,7 +183,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
{ {
char *filename; char *filename;
filename = grub_asprintf ("%s/parttool.lst", prefix); filename = grub_xasprintf ("%s/parttool.lst", prefix);
if (filename) if (filename)
{ {
grub_file_t file; grub_file_t file;

View file

@ -50,7 +50,7 @@ FUNC_NAME (const char *key, const char *var, int no_floppy)
char *buf; char *buf;
grub_file_t file; grub_file_t file;
buf = grub_asprintf ("(%s)%s", name, key); buf = grub_xasprintf ("(%s)%s", name, key);
if (! buf) if (! buf)
return 1; return 1;

View file

@ -805,7 +805,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
return 0; 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_free (partition_name);
grub_disk_close (parent); grub_disk_close (parent);

View file

@ -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) if (! array->name)
{ {
grub_free (array->uuid); grub_free (array->uuid);

View file

@ -208,7 +208,7 @@ grub_scsi_iterate (int (*hook) (const char *name))
for (i = 0; i < luns; i++) for (i = 0; i < luns; i++)
{ {
char *sname; char *sname;
sname = grub_asprintf ("%s%c", name, 'a' + i); sname = grub_xasprintf ("%s%c", name, 'a' + i);
if (!sname) if (!sname)
return 1; return 1;
if (hook (sname)) if (hook (sname))

View file

@ -201,7 +201,7 @@ grub_usbms_iterate (int (*hook) (const char *name, int luns))
for (p = grub_usbms_dev_list; p; p = p->next) for (p = grub_usbms_dev_list; p; p = p->next)
{ {
char *devname; char *devname;
devname = grub_asprintf ("usb%d", cnt); devname = grub_xasprintf ("usb%d", cnt);
if (hook (devname, p->luns)) if (hook (devname, p->luns))
{ {

View file

@ -255,7 +255,7 @@ grub_efiemu_autocore (void)
suffix = grub_efiemu_get_default_core_name (); suffix = grub_efiemu_get_default_core_name ();
filename = grub_asprintf ("%s/%s", prefix, suffix); filename = grub_xasprintf ("%s/%s", prefix, suffix);
if (! filename) if (! filename)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"couldn't allocate temporary space"); "couldn't allocate temporary space");

View file

@ -875,7 +875,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid)
data = grub_ext2_mount (disk); data = grub_ext2_mount (disk);
if (data) 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[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[2]),

View file

@ -833,7 +833,7 @@ grub_fat_uuid (grub_device_t device, char **uuid)
data = grub_fat_mount (disk); data = grub_fat_mount (disk);
if (data) if (data)
{ {
*uuid = grub_asprintf ("%04x-%04x", *uuid = grub_xasprintf ("%04x-%04x",
(grub_uint16_t) (data->uuid >> 16), (grub_uint16_t) (data->uuid >> 16),
(grub_uint16_t) data->uuid); (grub_uint16_t) data->uuid);
} }

View file

@ -1082,7 +1082,7 @@ grub_hfs_uuid (grub_device_t device, char **uuid)
data = grub_hfs_mount (device->disk); data = grub_hfs_mount (device->disk);
if (data && data->sblock.num_serial != 0) if (data && data->sblock.num_serial != 0)
{ {
*uuid = grub_asprintf ("%016llx", *uuid = grub_xasprintf ("%016llx",
(unsigned long long) (unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial)); grub_be_to_cpu64 (data->sblock.num_serial));
} }

View file

@ -995,7 +995,7 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid)
data = grub_hfsplus_mount (disk); data = grub_hfsplus_mount (disk);
if (data) if (data)
{ {
*uuid = grub_asprintf ("%016llx", *uuid = grub_xasprintf ("%016llx",
(unsigned long long) (unsigned long long)
grub_be_to_cpu64 (data->volheader.num_serial)); grub_be_to_cpu64 (data->volheader.num_serial));
} }

View file

@ -501,7 +501,7 @@ write_ip_env (grub_uint32_t *ip, const char *val)
return 0; return 0;
/* Normalize the IP. */ /* 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); (newip >> 16) & 0xff, (newip >> 24) & 0xff);
if (!buf) if (!buf)
return 0; 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) else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE; size = GRUB_PXE_MAX_BLKSIZE;
buf = grub_asprintf ("%d", size); buf = grub_xasprintf ("%d", size);
if (!buf) if (!buf)
return 0; return 0;
@ -560,7 +560,7 @@ GRUB_MOD_INIT(pxe)
{ {
char *buf; char *buf;
buf = grub_asprintf ("%d", grub_pxe_blksize); buf = grub_xasprintf ("%d", grub_pxe_blksize);
if (buf) if (buf)
grub_env_set ("net_pxe_blksize", buf); grub_env_set ("net_pxe_blksize", buf);
grub_free (buf); grub_free (buf);

View file

@ -840,7 +840,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
} }
else 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[0],
data->voldesc.modified.year[1], data->voldesc.modified.year[1],
data->voldesc.modified.year[2], data->voldesc.modified.year[2],

View file

@ -842,7 +842,7 @@ grub_jfs_uuid (grub_device_t device, char **uuid)
data = grub_jfs_mount (disk); data = grub_jfs_mount (disk);
if (data) 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", "%02x%02x%02x%02x%02x%02x",
data->sblock.uuid[0], data->sblock.uuid[1], data->sblock.uuid[0], data->sblock.uuid[1],
data->sblock.uuid[2], data->sblock.uuid[3], data->sblock.uuid[2], data->sblock.uuid[3],

View file

@ -1072,7 +1072,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
data = grub_ntfs_mount (disk); data = grub_ntfs_mount (disk);
if (data) if (data)
{ {
*uuid = grub_asprintf ("%016llx", (unsigned long long) data->uuid); *uuid = grub_xasprintf ("%016llx", (unsigned long long) data->uuid);
} }
else else
*uuid = NULL; *uuid = NULL;

View file

@ -1335,7 +1335,7 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid)
data = grub_reiserfs_mount (disk); data = grub_reiserfs_mount (disk);
if (data) 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[0]),
grub_be_to_cpu16 (data->superblock.uuid[1]), grub_be_to_cpu16 (data->superblock.uuid[1]),
grub_be_to_cpu16 (data->superblock.uuid[2]), grub_be_to_cpu16 (data->superblock.uuid[2]),

View file

@ -732,7 +732,7 @@ grub_ufs_uuid (grub_device_t device, char **uuid)
data = grub_ufs_mount (disk); data = grub_ufs_mount (disk);
if (data && (data->sblock.uuidhi != 0 || data->sblock.uuidlow != 0)) 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.uuidhi),
(unsigned) grub_le_to_cpu32 (data->sblock.uuidlow)); (unsigned) grub_le_to_cpu32 (data->sblock.uuidlow));
else else

View file

@ -777,7 +777,7 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
data = grub_xfs_mount (disk); data = grub_xfs_mount (disk);
if (data) 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[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]), grub_be_to_cpu16 (data->sblock.uuid[2]),

View file

@ -286,7 +286,7 @@ grub_gettext_init_ext (const char *lang)
/* Warning: if changing some paths in the below line, change the grub_malloc /* Warning: if changing some paths in the below line, change the grub_malloc
contents below. */ 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) if (!mo_file)
return; return;
@ -296,7 +296,7 @@ grub_gettext_init_ext (const char *lang)
if (fd_mo == NULL) if (fd_mo == NULL)
{ {
grub_free (mo_file); grub_free (mo_file);
mo_file = grub_asprintf ("%s.gz", mo_file); mo_file = grub_xasprintf ("%s.gz", mo_file);
if (!mo_file) if (!mo_file)
return; return;
fd_mo = grub_mofile_open (mo_file); fd_mo = grub_mofile_open (mo_file);

View file

@ -199,9 +199,9 @@ int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
va_list args); va_list args);
char *EXPORT_FUNC(grub_asprintf) (const char *fmt, ...) char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2))); __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_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn)); void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest, grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,

View file

@ -146,7 +146,7 @@ grub_device_iterate (int (*hook) (const char *name))
return 1; 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) if (!p->name)
{ {
grub_free (partition_name); grub_free (partition_name);

View file

@ -627,7 +627,7 @@ grub_dl_load (const char *name)
return 0; return 0;
} }
filename = grub_asprintf ("%s/%s.mod", grub_dl_dir, name); filename = grub_xasprintf ("%s/%s.mod", grub_dl_dir, name);
if (! filename) if (! filename)
return 0; return 0;

View file

@ -63,7 +63,7 @@ grub_efi_set_prefix (void)
if (p) if (p)
*p = '\0'; *p = '\0';
prefix = grub_asprintf ("(%s)%s", device, file); prefix = grub_xasprintf ("(%s)%s", device, file);
if (prefix) if (prefix)
{ {

View file

@ -357,7 +357,7 @@ grub_register_variable_hook (const char *name,
static char * static char *
mangle_data_slot_name (const char *name) mangle_data_slot_name (const char *name)
{ {
return grub_asprintf ("\e%s", name); return grub_xasprintf ("\e%s", name);
} }
grub_err_t grub_err_t

View file

@ -111,7 +111,7 @@ grub_machine_set_prefix (void)
*lastslash = '\0'; *lastslash = '\0';
grub_translate_ieee1275_path (filename); grub_translate_ieee1275_path (filename);
newprefix = grub_asprintf ("%s%s", prefix, filename); newprefix = grub_xasprintf ("%s%s", prefix, filename);
if (newprefix) if (newprefix)
{ {
grub_free (prefix); grub_free (prefix);

View file

@ -82,7 +82,7 @@ grub_children_iterate (char *devpath,
IEEE1275_MAX_PROP_LEN, &actual)) IEEE1275_MAX_PROP_LEN, &actual))
continue; continue;
fullname = grub_asprintf ("%s/%s", devpath, childname); fullname = grub_xasprintf ("%s/%s", devpath, childname);
if (!fullname) if (!fullname)
{ {
grub_free (childname); 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. */ /* Make sure filepath has leading backslash. */
if (filepath[0] != '\\') if (filepath[0] != '\\')
ret = grub_asprintf ("\\%s", filepath); ret = grub_xasprintf ("\\%s", filepath);
else else
ret = grub_strdup (filepath); ret = grub_strdup (filepath);
} }
@ -382,10 +382,10 @@ grub_ieee1275_encode_devname (const char *path)
/* GRUB partition 1 is OF partition 0. */ /* GRUB partition 1 is OF partition 0. */
partno++; partno++;
encoding = grub_asprintf ("(%s,%d)", device, partno); encoding = grub_xasprintf ("(%s,%d)", device, partno);
} }
else else
encoding = grub_asprintf ("(%s)", device); encoding = grub_xasprintf ("(%s)", device);
grub_free (partition); grub_free (partition);
grub_free (device); grub_free (device);

View file

@ -913,7 +913,7 @@ grub_snprintf (char *str, grub_size_t n, const char *fmt, ...)
#define PREALLOC_SIZE 255 #define PREALLOC_SIZE 255
char * char *
grub_avsprintf (const char *fmt, va_list ap) grub_xvasprintf (const char *fmt, va_list ap)
{ {
grub_size_t s, as = PREALLOC_SIZE; grub_size_t s, as = PREALLOC_SIZE;
char *ret; char *ret;
@ -934,13 +934,13 @@ grub_avsprintf (const char *fmt, va_list ap)
} }
char * char *
grub_asprintf (const char *fmt, ...) grub_xasprintf (const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *ret; char *ret;
va_start (ap, fmt); va_start (ap, fmt);
ret = grub_avsprintf (fmt, ap); ret = grub_xvasprintf (fmt, ap);
va_end (ap); va_end (ap);
return ret; return ret;

View file

@ -90,7 +90,7 @@ grub_machine_set_prefix (void)
} }
prefix = grub_ieee1275_encode_devname (bootpath); 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); grub_strcpy (grub_prefix, path);

View file

@ -1150,7 +1150,7 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
if (*p == '"') if (*p == '"')
p++; p++;
name = grub_asprintf ("kFreeBSD.%s", curr); name = grub_xasprintf ("kFreeBSD.%s", curr);
if (!name) if (!name)
goto fail; goto fail;
if (grub_env_set (name, p)) if (grub_env_set (name, p))

View file

@ -519,7 +519,7 @@ grub_linux_boot (void)
May change in future if we have modes without framebuffer. */ May change in future if we have modes without framebuffer. */
if (modevar && *modevar != 0) if (modevar && *modevar != 0)
{ {
tmp = grub_asprintf ("%s;text", modevar); tmp = grub_xasprintf ("%s;text", modevar);
if (! tmp) if (! tmp)
return grub_errno; return grub_errno;
err = grub_video_set_mode (tmp, 0, 0); err = grub_video_set_mode (tmp, 0, 0);
@ -797,7 +797,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
linux_mode linux_mode
= &linux_vesafb_modes[vid_mode - GRUB_LINUX_VID_MODE_VESA_START]; = &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].width,
linux_vesafb_res[linux_mode->res_index].height, linux_vesafb_res[linux_mode->res_index].height,
linux_mode->depth, linux_mode->depth,

View file

@ -252,11 +252,11 @@ grub_multiboot (int argc, char *argv[])
{ {
char *buf; char *buf;
if (header->depth && header->width && header->height) 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, header->depth, header->width,
header->height); header->height);
else if (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 else
buf = grub_strdup ("auto"); buf = grub_strdup ("auto");

View file

@ -150,7 +150,7 @@ set_video_mode (void)
else else
{ {
char *tmp; char *tmp;
tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
if (! tmp) if (! tmp)
return grub_errno; return grub_errno;
err = grub_video_set_mode (tmp, 0, 0); err = grub_video_set_mode (tmp, 0, 0);

View file

@ -47,7 +47,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
32 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS); 32 << GRUB_VIDEO_MODE_TYPE_DEPTH_POS);
else else
{ {
tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
if (! tmp) if (! tmp)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"couldn't allocate temporary storag"); "couldn't allocate temporary storag");

View file

@ -569,7 +569,7 @@ grub_xnu_register_memory (char *prefix, int *suffix,
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory"); return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory");
if (suffix) if (suffix)
{ {
driverkey->name = grub_asprintf ("%s%d", prefix, (*suffix)++); driverkey->name = grub_xasprintf ("%s%d", prefix, (*suffix)++);
if (!driverkey->name) if (!driverkey->name)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory"); return grub_error (GRUB_ERR_OUT_OF_MEMORY, "can't register memory");
} }

View file

@ -57,7 +57,7 @@ read_fs_list (void)
{ {
char *filename; char *filename;
filename = grub_asprintf ("%s/fs.lst", prefix); filename = grub_xasprintf ("%s/fs.lst", prefix);
if (filename) if (filename)
{ {
grub_file_t file; grub_file_t file;

View file

@ -107,7 +107,7 @@ iterate_partition (grub_disk_t disk, const grub_partition_t p)
if (! partition_name) if (! partition_name)
return 1; return 1;
name = grub_asprintf ("%s,%s", disk_name, partition_name); name = grub_xasprintf ("%s,%s", disk_name, partition_name);
grub_free (partition_name); grub_free (partition_name);
if (! name) if (! name)
@ -138,7 +138,7 @@ iterate_dir (const char *filename, const struct grub_dirhook_info *info)
{ {
char *fname; char *fname;
fname = grub_asprintf ("%s/", filename); fname = grub_xasprintf ("%s/", filename);
if (add_completion (fname, "", GRUB_COMPLETION_TYPE_FILE)) if (add_completion (fname, "", GRUB_COMPLETION_TYPE_FILE))
{ {
grub_free (fname); grub_free (fname);
@ -359,7 +359,7 @@ complete_arguments (char *command)
if (!option->longarg) if (!option->longarg)
continue; continue;
longarg = grub_asprintf ("--%s", option->longarg); longarg = grub_xasprintf ("--%s", option->longarg);
if (!longarg) if (!longarg)
return 1; return 1;

View file

@ -80,7 +80,7 @@ read_crypto_list (void)
return; return;
} }
filename = grub_asprintf ("%s/crypto.lst", prefix); filename = grub_xasprintf ("%s/crypto.lst", prefix);
if (!filename) if (!filename)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;

View file

@ -69,7 +69,7 @@ read_command_list (void)
{ {
char *filename; char *filename;
filename = grub_asprintf ("%s/command.lst", prefix); filename = grub_xasprintf ("%s/command.lst", prefix);
if (filename) if (filename)
{ {
grub_file_t file; grub_file_t file;

View file

@ -172,7 +172,7 @@ read_handler_list (void)
{ {
char *filename; char *filename;
filename = grub_asprintf ("%s/handler.lst", prefix); filename = grub_xasprintf ("%s/handler.lst", prefix);
if (filename) if (filename)
{ {
grub_file_t file; grub_file_t file;

View file

@ -412,7 +412,7 @@ grub_normal_init_page (struct grub_term_output *term)
grub_term_cls (term); grub_term_cls (term);
msg_formatted = grub_asprintf (msg, PACKAGE_VERSION); msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION);
if (!msg_formatted) if (!msg_formatted)
return; return;
@ -502,7 +502,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),
prefix = grub_env_get ("prefix"); prefix = grub_env_get ("prefix");
if (prefix) if (prefix)
{ {
config = grub_asprintf ("%s/grub.cfg", prefix); config = grub_xasprintf ("%s/grub.cfg", prefix);
if (! config) if (! config)
goto quit; goto quit;
@ -541,7 +541,7 @@ grub_normal_reader_init (int nested)
const char *msg_esc = _("ESC at any time exits."); const char *msg_esc = _("ESC at any time exits.");
char *msg_formatted; char *msg_formatted;
msg_formatted = grub_asprintf (msg, nested ? msg_esc : ""); msg_formatted = grub_xasprintf (msg, nested ? msg_esc : "");
if (!msg_formatted) if (!msg_formatted)
return grub_errno; return grub_errno;
@ -566,9 +566,9 @@ grub_normal_read_line_real (char **line, int cont, int nested)
char *prompt; char *prompt;
if (cont) if (cont)
prompt = grub_asprintf (">"); prompt = grub_xasprintf (">");
else else
prompt = grub_asprintf ("%s>", parser->name); prompt = grub_xasprintf ("%s>", parser->name);
if (!prompt) if (!prompt)
return grub_errno; return grub_errno;

View file

@ -187,7 +187,7 @@ command-line or ESC to return menu."), STANDARD_MARGIN, STANDARD_MARGIN,
"entry is highlighted.\n"); "entry is highlighted.\n");
char *msg_translated; 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); (grub_uint32_t) GRUB_TERM_DISP_DOWN);
if (!msg_translated) if (!msg_translated)
return; 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); 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) if (!msg_translated)
{ {
grub_print_error (); grub_print_error ();

View file

@ -167,7 +167,7 @@ read_terminal_list (void)
return; return;
} }
filename = grub_asprintf ("%s/terminal.lst", prefix); filename = grub_xasprintf ("%s/terminal.lst", prefix);
if (!filename) if (!filename)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;

View file

@ -175,7 +175,7 @@ fail:
static char * static char *
acorn_partition_map_get_name (const grub_partition_t p) acorn_partition_map_get_name (const grub_partition_t p)
{ {
return grub_asprintf ("%d", p->index + 1); return grub_xasprintf ("%d", p->index + 1);
} }

View file

@ -184,7 +184,7 @@ amiga_partition_map_probe (grub_disk_t disk, const char *str)
static char * static char *
amiga_partition_map_get_name (const grub_partition_t p) amiga_partition_map_get_name (const grub_partition_t p)
{ {
return grub_asprintf ("%d", p->index + 1); return grub_xasprintf ("%d", p->index + 1);
} }

View file

@ -227,7 +227,7 @@ apple_partition_map_probe (grub_disk_t disk, const char *str)
static char * static char *
apple_partition_map_get_name (const grub_partition_t p) apple_partition_map_get_name (const grub_partition_t p)
{ {
return grub_asprintf ("%d", p->index + 1); return grub_xasprintf ("%d", p->index + 1);
} }

View file

@ -162,7 +162,7 @@ gpt_partition_map_probe (grub_disk_t disk, const char *str)
static char * static char *
gpt_partition_map_get_name (const grub_partition_t p) gpt_partition_map_get_name (const grub_partition_t p)
{ {
return grub_asprintf ("%d", p->index + 1); return grub_xasprintf ("%d", p->index + 1);
} }

View file

@ -303,11 +303,11 @@ pc_partition_map_get_name (const grub_partition_t p)
struct grub_msdos_partition *pcdata = p->data; struct grub_msdos_partition *pcdata = p->data;
if (pcdata->bsd_part < 0) 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) else if (pcdata->dos_part < 0)
return grub_asprintf ("%c", pcdata->bsd_part + 'a'); return grub_xasprintf ("%c", pcdata->bsd_part + 'a');
else else
return grub_asprintf ("%d,%c", pcdata->dos_part + 1, return grub_xasprintf ("%d,%c", pcdata->dos_part + 1,
pcdata->bsd_part + 'a'); pcdata->bsd_part + 'a');
} }

View file

@ -184,7 +184,7 @@ sun_partition_map_probe (grub_disk_t disk, const char *str)
static char * static char *
sun_partition_map_get_name (const grub_partition_t p) 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. */ /* Partition map type. */

View file

@ -270,7 +270,7 @@ grub_gfxterm_init (void)
GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0); GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
else else
{ {
tmp = grub_asprintf ("%s;" DEFAULT_VIDEO_MODE, modevar); tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
if (!tmp) if (!tmp)
return grub_errno; return grub_errno;
err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0); err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);

View file

@ -128,7 +128,7 @@ grub_ofconsole_setcolorstate (grub_term_color_state state)
return; 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) if (setcol)
grub_ofconsole_writeesc (setcol); grub_ofconsole_writeesc (setcol);
grub_free (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_x = x;
grub_curr_y = y; 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) if (s)
grub_ofconsole_writeesc (s); grub_ofconsole_writeesc (s);
grub_free (s); grub_free (s);

View file

@ -56,7 +56,7 @@ add_failure (const char *file,
failure->file = grub_strdup (file ? : "<unknown_file>"); failure->file = grub_strdup (file ? : "<unknown_file>");
failure->funp = grub_strdup (funp ? : "<unknown_function>"); failure->funp = grub_strdup (funp ? : "<unknown_function>");
failure->line = line; 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)); grub_list_push (GRUB_AS_LIST_P (&failure_list), GRUB_AS_LIST (failure));
} }

View file

@ -285,8 +285,8 @@ fstest (char **images, int num_disks, int cmd, int n, char **args)
for (i = 0; i < num_disks; i++) for (i = 0; i < num_disks; i++)
{ {
loop_name = grub_asprintf ("loop%d", i); loop_name = grub_xasprintf ("loop%d", i);
host_file = grub_asprintf ("(host)%s", images[i]); host_file = grub_xasprintf ("(host)%s", images[i]);
if (!loop_name || !host_file) 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++) for (i = 0; i < num_disks; i++)
{ {
grub_free (loop_name); grub_free (loop_name);
loop_name = grub_asprintf ("loop%d", i); loop_name = grub_xasprintf ("loop%d", i);
if (!loop_name) if (!loop_name)
{ {
grub_free (host_file); grub_free (host_file);