From 69b34ed804d9560de6661a9f7d4db57f1fbe2d8e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 4 Mar 2007 23:50:44 +0000 Subject: [PATCH] Use function name rpl_vasnprintf if vasnprintf already exists. --- ChangeLog | 2 ++ lib/vasnprintf.h | 6 +++++- m4/vasnprintf-posix.m4 | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0088e7c1aa..94f1a5582b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ * lib/vasnprintf.c: Include isnan.h, isnanl.h, printf-frexp.h, printf-frexpl.h. (VASNPRINTF): Handle the 'a' and 'A' directives here, if needed. + * lib/vasnprintf.h (asnprintf, vasnprintf): Rename if + REPLACE_VASNPRINTF is defined. * m4/vasnprintf.m4 (gl_REPLACE_VASNPRINTF): New macro, extracted from gl_FUNC_VASNPRINTF. (gl_FUNC_VASNPRINTF): Invoke it. diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h index 894008caec..393a7c801b 100644 --- a/lib/vasnprintf.h +++ b/lib/vasnprintf.h @@ -1,5 +1,5 @@ /* vsprintf with automatic memory allocation. - Copyright (C) 2002-2004 Free Software Foundation, Inc. + Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,6 +65,10 @@ extern "C" { free (output); } */ +#if REPLACE_VASNPRINTF +# define asnprintf rpl_asnprintf +# define vasnprintf rpl_vasnprintf +#endif extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) diff --git a/m4/vasnprintf-posix.m4 b/m4/vasnprintf-posix.m4 index 8556794134..fd88860f30 100644 --- a/m4/vasnprintf-posix.m4 +++ b/m4/vasnprintf-posix.m4 @@ -19,6 +19,10 @@ AC_DEFUN([gl_FUNC_VASNPRINTF_POSIX], && test $ac_cv_func_vasnprintf = yes; then : # vasnprintf exists and is already POSIX compliant. else + if test $ac_cv_func_vasnprintf = yes; then + AC_DEFINE([REPLACE_VASNPRINTF], 1, + [Define if vasnprintf exists but is overridden by gnulib.]) + fi if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, [Define if the vasnprintf implementation needs special code for -- 2.30.2