[PATCH] Silence compiler warnings about asprintf, vasprintf
Pavel A.
pavel.aronsky at daynix.com
Mon Jun 16 06:43:41 PDT 2014
From: Pavel A <pavel.aronsky at daynix.com>
Proposed fix for compiler warnings in common/compat.c
when buliding for Windows (mingw).
This issue has been reported in bug #76594
a. Moved vasprintf before asprintf
b. Added prototypes for each of them
Thanks,
pa
Signed-off-by: Pavel A <pavel.aronsky at daynix.com>
---
common/compat.c | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/common/compat.c b/common/compat.c
index 8ad35b7..78e90e5 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -519,28 +519,11 @@ strconcat (const char *first,
#endif /* HAVE_STRCONCAT */
-#ifndef HAVE_ASPRINTF
-
-int
-asprintf (char **strp,
- const char *fmt,
- ...)
-{
- va_list va;
- int ret;
-
- va_start (va, fmt);
- ret = vasprintf (strp, fmt, va);
- va_end (va);
-
- return ret;
-}
-
-#endif /* HAVE_ASPRINTF */
-
#ifndef HAVE_VASPRINTF
#include <stdio.h>
+int vasprintf(char **strp, const char *fmt, va_list ap);
+
int
vasprintf (char **strp,
const char *fmt,
@@ -585,6 +568,27 @@ vasprintf (char **strp,
#endif /* HAVE_VASPRINTF */
+#ifndef HAVE_ASPRINTF
+
+int asprintf(char **strp, const char *fmt, ...);
+
+int
+asprintf (char **strp,
+ const char *fmt,
+ ...)
+{
+ va_list va;
+ int ret;
+
+ va_start (va, fmt);
+ ret = vasprintf (strp, fmt, va);
+ va_end (va);
+
+ return ret;
+}
+
+#endif /* HAVE_ASPRINTF */
+
#ifndef HAVE_GMTIME_R
struct tm *
--
1.9.3
More information about the p11-glue
mailing list