diff options
-rw-r--r-- | common/compat.c | 42 |
1 files 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 <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 * |