Redirect xasprintf to grub_xvasprintf rather than having #ifdef's
for vasprintf presence.
This commit is contained in:
parent
30b03dc22e
commit
0f7e980b29
4 changed files with 9 additions and 45 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-05-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Redirect xasprintf to grub_xvasprintf rather than having #ifdef's
|
||||||
|
for vasprintf presence.
|
||||||
|
|
||||||
2013-05-10 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-05-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/grub-install.in: Handle efibootmgr presence check.
|
* util/grub-install.in: Handle efibootmgr presence check.
|
||||||
|
|
|
@ -355,7 +355,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for functions and headers.
|
# Check for functions and headers.
|
||||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
|
AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
|
||||||
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
|
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
|
||||||
|
|
||||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
||||||
|
|
|
@ -145,36 +145,6 @@ xstrdup (const char *str)
|
||||||
return newstr;
|
return newstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_VASPRINTF
|
|
||||||
|
|
||||||
int
|
|
||||||
vasprintf (char **buf, const char *fmt, va_list ap)
|
|
||||||
{
|
|
||||||
/* Should be large enough. */
|
|
||||||
*buf = xmalloc (512);
|
|
||||||
|
|
||||||
return vsnprintf (*buf, 512, fmt, ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
|
||||||
|
|
||||||
int
|
|
||||||
asprintf (char **buf, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, fmt);
|
|
||||||
status = vasprintf (buf, fmt, ap);
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xasprintf (const char *fmt, ...)
|
xasprintf (const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -182,12 +152,9 @@ xasprintf (const char *fmt, ...)
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
if (vasprintf (&result, fmt, ap) < 0)
|
result = grub_xvasprintf (fmt, ap);
|
||||||
{
|
if (!result)
|
||||||
if (errno == ENOMEM)
|
grub_util_error ("%s", _("out of memory"));
|
||||||
grub_util_error ("%s", _("out of memory"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,14 +64,6 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (
|
||||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn));
|
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2), noreturn));
|
||||||
|
|
||||||
#ifndef HAVE_VASPRINTF
|
|
||||||
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
|
||||||
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char * canonicalize_file_name (const char *path);
|
extern char * canonicalize_file_name (const char *path);
|
||||||
|
|
||||||
#ifdef HAVE_DEVICE_MAPPER
|
#ifdef HAVE_DEVICE_MAPPER
|
||||||
|
|
Loading…
Reference in a new issue