From 4faa892e97e59dd6ab01b4cae3e2534663e18ba7 Mon Sep 17 00:00:00 2001 From: Pavel A Date: Fri, 20 Jun 2014 13:42:14 +0200 Subject: 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 --- common/compat.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/common/compat.c b/common/compat.c index f5b88ec..85a33c8 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 +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 * -- cgit v1.2.1