]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Redirect xasprintf to grub_xvasprintf rather than having #ifdef's
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 10 May 2013 18:57:32 +0000 (20:57 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 10 May 2013 18:57:32 +0000 (20:57 +0200)
for vasprintf presence.

ChangeLog
configure.ac
grub-core/kern/emu/misc.c
include/grub/emu/misc.h

index fdfa56b80035c254207244d2677571a3abce9fa7..a57e631c9c5ad4d0854e8d46079bdde6019a872a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * util/grub-install.in: Handle efibootmgr presence check.
index fa0e00a12a38b21f5063c73a1c631965034b2208..bb4071a90148b01f69a1fcfc22f93e67ab03663e 100644 (file)
@@ -355,7 +355,7 @@ else
 fi
 
 # 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_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
index 21954ed50d209d76504153aa74e0e80291168d9d..ce338fd20d73383ce9d73db65ef6dff81f58f49b 100644 (file)
@@ -145,36 +145,6 @@ xstrdup (const char *str)
   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 *
 xasprintf (const char *fmt, ...)
 { 
@@ -182,12 +152,9 @@ xasprintf (const char *fmt, ...)
   char *result;
   
   va_start (ap, fmt);
-  if (vasprintf (&result, fmt, ap) < 0)
-    { 
-      if (errno == ENOMEM)
-        grub_util_error ("%s", _("out of memory"));
-      return NULL;
-    }
+  result = grub_xvasprintf (fmt, ap);
+  if (!result)
+    grub_util_error ("%s", _("out of memory"));
   
   return result;
 }
index 3c9f07ed37dcb9cfe16ba60e96ba214a6d2997c7..92669f09aae55979577bc4255210a13d2a7bff7a 100644 (file)
@@ -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_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);
 
 #ifdef HAVE_DEVICE_MAPPER