From 1154c8838177cf4dfd9c85aa47df4ba70335e9cc Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 29 Oct 2013 11:05:59 +0100 Subject: [PATCH] Add asprint() compatibility function for systems lacking it --- NEWS | 4 ++++ configure.ac | 2 +- libatalk/compat/misc.c | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index aa61935e..1fd4eeb9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Changes in 3.1.1 +================ +* FIX: Add asprint() compatibility function for systems lacking it + Changes in 3.1.0 ================ * NEW: AFP Spotlight support with Gnome Tracker diff --git a/configure.ac b/configure.ac index 8902ae1e..72c06035 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,7 @@ AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include ]) dnl these tests have been comfirmed to be needed in 2011 AC_CHECK_FUNCS(backtrace_symbols dirfd getusershell pread pwrite pselect) -AC_CHECK_FUNCS(setlinebuf strlcat strlcpy strnlen mempcpy vasprintf) +AC_CHECK_FUNCS(setlinebuf strlcat strlcpy strnlen mempcpy vasprintf asprintf) AC_CHECK_FUNCS(mmap utime getpagesize) dnl needed by tbd dnl search for necessary libraries diff --git a/libatalk/compat/misc.c b/libatalk/compat/misc.c index 32e2943d..614c6f2d 100644 --- a/libatalk/compat/misc.c +++ b/libatalk/compat/misc.c @@ -61,3 +61,17 @@ int vasprintf(char **ret, const char *fmt, va_list ap) } } #endif + +#ifndef HAVE_ASPRINTF +int asprintf(char **strp, const char *fmt, ...) +{ + va_list ap; + int len; + + va_start(ap, fmt); + len = vasprintf(strp, fmt, ap); + va_end(ap); + + return len; +} +#endif -- 2.39.2