asprintf and snprintf support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-29 10:04:06 +01:00
parent c181849b95
commit 8b442f3f4c
60 changed files with 396 additions and 345 deletions

View file

@ -275,14 +275,19 @@ grub_gettext_init_ext (const char *lang)
/* Warning: if changing some paths in the below line, change the grub_malloc
contents below. */
grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang);
mo_file = grub_asprintf ("%s/%s.mo", locale_dir, lang);
if (!mo_file)
return;
fd_mo = grub_mofile_open (mo_file);
/* Will try adding .gz as well. */
if (fd_mo == NULL)
{
grub_sprintf (mo_file, "%s.gz", mo_file);
grub_free (mo_file);
mo_file = grub_asprintf ("%s.gz", mo_file);
if (!mo_file)
return;
fd_mo = grub_mofile_open (mo_file);
}