]> granicus.if.org Git - p11-kit/commitdiff
Proposed fix for compiler warnings in common/compat.c
authorPavel A <pavel.aronsky@daynix.com>
Fri, 20 Jun 2014 11:42:14 +0000 (13:42 +0200)
committerStef Walter <stef@thewalter.net>
Fri, 20 Jun 2014 11:42:14 +0000 (13:42 +0200)
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@daynix.com>
common/compat.c

index f5b88ecda47a0061effbb691e1be85e277b8f8a6..85a33c81ce6393442f46933e39b25b9b574d9255 100644 (file)
@@ -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 *