Commit 8be09879 authored by Paul Ramsey's avatar Paul Ramsey

Complete alternate implementation of vsnprintf, vasprintf for non-C99 systems. (#1668)


git-svn-id: http://svn.osgeo.org/postgis/trunk@9477 b70326c6-7e19-0410-871a-916f4a2858ee
parent 03de5894
......@@ -14,7 +14,6 @@ AC_INIT()
AC_CONFIG_HEADERS([postgis_config.h])
AC_CONFIG_MACRO_DIR([macros])
dnl Invoke libtool: we do this as it is the easiest way to find the PIC
dnl flags required to build liblwgeom
AC_PROG_LIBTOOL
......@@ -28,6 +27,35 @@ AC_PROG_CXX
AC_PATH_PROG([ANT], [ant], [])
AC_SUBST([ANT])
dnl
dnl Types
dnl
AC_TYPE_LONG_LONG_INT
AC_TYPE_LONG_DOUBLE
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
dnl
dnl Functions
dnl
HW_FUNC_VA_COPY
HW_FUNC___VA_COPY
HW_FUNC_VSNPRINTF
HW_FUNC_SNPRINTF
HW_FUNC_VASPRINTF
HW_FUNC_ASPRINTF
AC_FUNC_FSEEKO
dnl
dnl Check for platform-specific functions
dnl
dnl AC_CHECK_FUNC(vasprintf, [HAVE_VASPRINTF=1], [HAVE_VASPRINTF=0])
dnl AC_DEFINE([HAVE_VASPRINTF])
dnl AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0])
dnl AC_DEFINE([HAVE_ASPRINTF])
dnl
dnl Define PIC flags in PICFLAGS (note: this variable is set as part of libtool initialisation above)
dnl
......@@ -73,7 +101,6 @@ AC_SUBST([POSTGIS_MICRO_VERSION])
dnl
dnl Search for flex/bison to build the parser
dnl
AC_PROG_LEX
AC_PROG_YACC
AC_SUBST([LEX])
......@@ -87,16 +114,6 @@ AC_DEFINE_UNQUOTED([HAVE_IEEEFP_H], [$HAVE_IEEEFP_H], [ieeefp.h header])
AC_CHECK_HEADER([termios.h], [HAVE_TERMIOS_H=1], [HAVE_TERMIOS_H=0])
AC_DEFINE_UNQUOTED([HAVE_TERMIOS_H], [$HAVE_TERMIOS_H], [termios.h header])
dnl
dnl Check for platform-specific functions
dnl
AC_CHECK_FUNC(vasprintf, [HAVE_VASPRINTF=1], [HAVE_VASPRINTF=0])
AC_DEFINE([HAVE_VASPRINTF])
AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0])
AC_DEFINE([HAVE_ASPRINTF])
AC_FUNC_FSEEKO()
dnl
dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths
dnl for in-place regression tests
......
......@@ -68,6 +68,7 @@ SA_OBJS = \
lwsegmentize.o \
lwlinearreferencing.o \
lwprint.o \
snprintf.o \
vsprintf.o \
g_box.o \
g_serialized.o \
......@@ -87,6 +88,8 @@ SA_OBJS = \
lwgeom_geos_split.o \
lwgeom_transform.o
NM_OBJS = \
lwspheroid.o
......
......@@ -77,6 +77,12 @@ static void do_kml_test_prefix(char * in, char * out, int precision, const char
static void out_kml_test_precision(void)
{
/* huge data */
do_kml_test(
"POINT(1E300 -1E300)",
"<Point><coordinates>1e+300,-1e+300</coordinates></Point>",
0);
/* 0 precision, i.e a round */
do_kml_test(
"POINT(1.1111111111111 1.1111111111111)",
......@@ -94,12 +100,6 @@ static void out_kml_test_precision(void)
"POINT(1.2345678901234 1.2345678901234)",
"<Point><coordinates>1.23456789,1.23456789</coordinates></Point>",
8);
/* huge data */
do_kml_test(
"POINT(1E300 -1E300)",
"<Point><coordinates>1e+300,-1e+300</coordinates></Point>",
0);
}
......
......@@ -227,7 +227,19 @@ void default_freeor(void *ptr);
void default_errorreporter(const char *fmt, va_list ap);
void default_noticereporter(const char *fmt, va_list ap);
extern int lw_vasprintf (char **result, const char *format, va_list args);
extern int lw_vasprintf(char **result, const char *format, va_list ap);
extern int lw_vsnprintf(char *s, size_t n, const char *format, va_list ap);
extern int lw_snprintf
#if __STDC__
(char *s, size_t n, const char *format, ...);
#else
(result, n, va_alist);
char *result;
size_t n;
va_dcl
#endif
extern int lw_asprintf
#if __STDC__
(char **result, const char *format, ...);
......@@ -238,6 +250,7 @@ va_dcl
#endif
/******************************************************************/
typedef struct {
......
......@@ -31,6 +31,25 @@
#include "liblwgeom.h"
/**
* SNPRINTF Compatibility Functions
*/
#if HAVE_STDARG_H
#include <stdarg.h>
#if !HAVE_VSNPRINTF
int rpl_vsnprintf(char *, size_t, const char *, va_list);
#endif
#if !HAVE_SNPRINTF
int rpl_snprintf(char *, size_t, const char *, ...);
#endif
#if !HAVE_VASPRINTF
int rpl_vasprintf(char **, const char *, va_list);
#endif
#if !HAVE_ASPRINTF
int rpl_asprintf(char **, const char *, ...);
#endif
#endif /* HAVE_STDARG_H */
/**
* PI
*/
......
......@@ -28,7 +28,7 @@ lwgeom_geos_error(const char *fmt, ...)
va_start(ap, fmt);
/* Call the supplied function */
if ( LWGEOM_GEOS_ERRMSG_MAXSIZE-1 < vsnprintf(lwgeom_geos_errmsg, LWGEOM_GEOS_ERRMSG_MAXSIZE-1, fmt, ap) )
if ( LWGEOM_GEOS_ERRMSG_MAXSIZE-1 < lw_vsnprintf(lwgeom_geos_errmsg, LWGEOM_GEOS_ERRMSG_MAXSIZE-1, fmt, ap) )
{
lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE-1] = '\0';
}
......
This diff is collapsed.
......@@ -201,22 +201,21 @@ stringbuffer_avprintf(stringbuffer_t *s, const char *fmt, va_list ap)
int len = 0; /* Length of the output */
va_list ap2;
/* Make a copy of the variadic arguments, in case we need to print twice */
/* Print to our buffer, using a copy of the variadic arguments, in case we need to print twice*/
va_copy(ap2, ap);
/* Print to our buffer */
len = vsnprintf(s->str_end, maxlen, fmt, ap);
len = lw_vsnprintf(s->str_end, maxlen, fmt, ap2);
va_end(ap2);
/* We didn't have enough space! */
/* Either Unix vsnprint returned write length larger than our buffer */
/* or Windows vsnprintf returned an error code. */
if ( (len >= maxlen) || (len < 0) )
if ( len >= maxlen )
{
stringbuffer_makeroom(s, len + 1);
maxlen = (s->capacity - (s->str_end - s->str_start));
/* Try to print a second time */
len = vsnprintf(s->str_end, maxlen, fmt, ap2);
len = lw_vsnprintf(s->str_end, maxlen, fmt, ap);
/* Printing error? Error! */
if ( len < 0 ) return len;
......@@ -224,9 +223,6 @@ stringbuffer_avprintf(stringbuffer_t *s, const char *fmt, va_list ap)
if ( len >= maxlen ) return -1;
}
/* Finish up with our copy of the variadic arguments */
va_end(ap2);
/* Move end pointer forward and return. */
s->str_end += len;
return len;
......
/* Like vsprintf but provides a pointer to malloc'd storage, which must
be freed by the caller.
Copyright (C) 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
/**********************************************************************
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.refractions.net
*
* Copyright (C) 2012 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
*
**********************************************************************/
#include "liblwgeom_internal.h"
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if __STDC__
# include <stdarg.h>
int
lw_vasprintf (char **result, const char *format, va_list args)
{
#if HAVE_VASPRINTF
return vasprintf(result, format, args);
#else
# include <varargs.h>
return rpl_vasprintf(result, format, args);
#endif
}
#ifdef TEST
int global_total_width;
int
lw_vsnprintf(char *s, size_t n, const char *format, va_list ap)
{
#if HAVE_VSNPRINTF
return vsnprintf(s, n, format, ap);
#else
return rpl_vsnprintf(s, n, format, ap);
#endif
}
/* Make sure we have a va_copy that will work on all platforms */
#ifndef va_copy
# ifdef __va_copy
# define va_copy(d, s) __va_copy((d), (s))
# else
# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
# endif
#endif
int lw_vasprintf (char **result, const char *format, va_list args);
int lw_asprintf
int
lw_snprintf
#if __STDC__
(char **result, const char *format, ...);
(char *s, size_t n, const char *format, ...)
#else
(result, va_alist);
char **result;
(s, n, va_alist)
char *s;
size_t n;
va_dcl
#endif
static int
int_vasprintf (result, format, args)
char **result;
const char *format;
va_list *args;
{
const char *p = format;
/* Add one to make sure that it is never zero, which might cause malloc
to return NULL. */
int total_width = strlen (format) + 1;
va_list ap;
memcpy (&ap, args, sizeof (va_list));
va_list args;
int done;
while (*p != '\0')
{
if (*p++ == '%')
{
while (strchr ("-+ #0", *p))
++p;
if (*p == '*')
{
++p;
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, (char **) &p, 10);
if (*p == '.')
{
++p;
if (*p == '*')
{
++p;
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, (char **) &p, 10);
}
while (strchr ("hlLjtz", *p))
++p;
/* Should be big enough for any format specifier except %s
and floats. */
total_width += 30;
switch (*p)
{
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
case 'c':
(void) va_arg (ap, int);
break;
case 'f':
{
double arg = va_arg (ap, double);
if (arg >= 1.0 || arg <= -1.0)
/* Since an ieee double can have an exponent of 307, we'll
make the buffer wide enough to cover the gross case. */
total_width += 307;
}
break;
case 'e':
case 'E':
case 'g':
case 'G':
(void) va_arg (ap, double);
break;
case 's':
total_width += strlen (va_arg (ap, char *));
break;
case 'p':
case 'n':
(void) va_arg (ap, char *);
break;
}
p++;
}
}
#ifdef TEST
global_total_width = total_width;
#if __STDC__
va_start (args, format);
#else
char *format;
va_start (args);
format = va_arg (args, char *);
#endif
*result = malloc (total_width);
if (*result != NULL)
return vsprintf (*result, format, *args);
else
return 0;
}
int
lw_vasprintf (result, format, args)
char **result;
const char *format;
va_list args;
{
va_list temp;
va_copy(temp, args);
done = lw_vsnprintf (s, n, format, args);
va_end (args);
return int_vasprintf (result, format, &temp);
return done;
}
int
lw_asprintf
#if __STDC__
(char **result, const char *format, ...)
(char **s, const char *format, ...)
#else
(result, va_alist)
char **result;
(s, va_alist)
char **s;
va_dcl
#endif
{
......@@ -177,8 +80,8 @@ va_dcl
va_start (args);
format = va_arg (args, char *);
#endif
done = lw_vasprintf (result, format, args);
done = lw_vasprintf (s, format, args);
va_end (args);
return done;
}
}
\ No newline at end of file
......@@ -157,7 +157,7 @@ pg_error(const char *fmt, va_list ap)
char errmsg[ERRMSG_MAXLEN+1];
vsnprintf (errmsg, ERRMSG_MAXLEN, fmt, ap);
lw_vsnprintf (errmsg, ERRMSG_MAXLEN, fmt, ap);
errmsg[ERRMSG_MAXLEN]='\0';
ereport(ERROR, (errmsg_internal("%s", errmsg)));
......
# $Id: snprintf.m4,v 1.1.1.1 2008/01/06 03:24:00 holger Exp $
# Copyright (c) 2008 Holger Weiss <holger@jhweiss.de>.
#
# This code may freely be used, modified and/or redistributed for any purpose.
# It would be nice if additions and fixes to this file (including trivial code
# cleanups) would be sent back in order to let me include them in the version
# available at <http://www.jhweiss.de/software/snprintf.html>. However, this is
# not a requirement for using or redistributing (possibly modified) versions of
# this file, nor is leaving this notice intact mandatory.
# HW_HEADER_STDARG_H
# ------------------
# Define HAVE_STDARG_H to 1 if <stdarg.h> is available.
AC_DEFUN([HW_HEADER_STDARG_H],
[
AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used.
AC_CHECK_HEADERS_ONCE([stdarg.h])
])# HW_HEADER_STDARG_H
# HW_HEADER_VARARGS_H
# -------------------
# Define HAVE_VARARGS_H to 1 if <varargs.h> is available.
AC_DEFUN([HW_HEADER_VARARGS_H],
[
AC_PREREQ([2.60])dnl Older releases should work if AC_CHECK_HEADERS is used.
AC_CHECK_HEADERS_ONCE([varargs.h])
])# HW_HEADER_VARARGS_H
# HW_FUNC_VA_COPY
# ---------------
# Set $hw_cv_func_va_copy to "yes" or "no". Define HAVE_VA_COPY to 1 if
# $hw_cv_func_va_copy is set to "yes". Note that it's "unspecified whether
# va_copy and va_end are macros or identifiers declared with external linkage."
# (C99: 7.15.1, 1) Therefore, the presence of va_copy(3) cannot simply "be
# tested with #ifdef", as suggested by the Autoconf manual (5.5.1).
AC_DEFUN([HW_FUNC_VA_COPY],
[
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H.
AC_CACHE_CHECK([for va_copy],
[hw_cv_func_va_copy],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#elif HAVE_VARARGS_H
#include <varargs.h>
#endif]],
[[va_list ap, aq; va_copy(aq, ap);]])],
[hw_cv_func_va_copy=yes],
[hw_cv_func_va_copy=no],
[hw_cv_func_va_copy=no])])
AS_IF([test "$hw_cv_func_va_copy" = yes],
[AC_DEFINE([HAVE_VA_COPY], [1],
[Define to 1 if you have the `va_copy' function or macro.])])
])# HW_FUNC_VA_COPY
# HW_FUNC___VA_COPY
# -----------------
# Set $hw_cv_func___va_copy to "yes" or "no". Define HAVE___VA_COPY to 1 if
# $hw_cv_func___va_copy is set to "yes".
AC_DEFUN([HW_FUNC___VA_COPY],
[
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_REQUIRE([HW_HEADER_VARARGS_H])dnl Our check evaluates HAVE_VARARGS_H.
AC_CACHE_CHECK([for __va_copy],
[hw_cv_func___va_copy],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#elif HAVE_VARARGS_H
#include <varargs.h>
#endif]],
[[va_list ap, aq; __va_copy(aq, ap);]])],
[hw_cv_func___va_copy=yes],
[hw_cv_func___va_copy=no],
[hw_cv_func___va_copy=no])])
AS_IF([test "$hw_cv_func___va_copy" = yes],
[AC_DEFINE([HAVE___VA_COPY], [1],
[Define to 1 if you have the `__va_copy' function or macro.])])
])# HW_FUNC___VA_COPY
# HW_FUNC_VSNPRINTF
# -----------------
# Set $hw_cv_func_vsnprintf and $hw_cv_func_vsnprintf_c99 to "yes" or "no",
# respectively. Define HAVE_VSNPRINTF to 1 only if $hw_cv_func_vsnprintf_c99
# is set to "yes". Otherwise, define vsnprintf to rpl_vsnprintf and make sure
# the replacement function will be built.
AC_DEFUN([HW_FUNC_VSNPRINTF],
[
AC_PREREQ([2.60])dnl 2.59 should work if some AC_TYPE_* macros are replaced.
AC_REQUIRE([HW_HEADER_STDARG_H])dnl Our check evaluates HAVE_STDARG_H.
AC_CHECK_FUNC([vsnprintf],
[hw_cv_func_vsnprintf=yes],
[hw_cv_func_vsnprintf=no])
AS_IF([test "$hw_cv_func_vsnprintf" = yes],
[AC_CACHE_CHECK([whether vsnprintf is C99 compliant],
[hw_cv_func_vsnprintf_c99],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#if HAVE_STDARG_H
#include <stdarg.h>
#endif
#include <stdio.h>
static int testprintf(char *buf, size_t size, const char *format, ...)
{
int result;
va_list ap;
va_start(ap, format);
result = vsnprintf(buf, size, format, ap);
va_end(ap);
return result;
}]],
[[char buf[43];
if (testprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 ||
testprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 ||
buf[0] != 'T' || buf[3] != '\0')
return 1;]])],
[hw_cv_func_vsnprintf_c99=yes],
[hw_cv_func_vsnprintf_c99=no],
[hw_cv_func_vsnprintf_c99=no])])],
[hw_cv_func_snprintf_c99=no])
AS_IF([test "$hw_cv_func_vsnprintf_c99" = yes],
[AC_DEFINE([HAVE_VSNPRINTF], [1],
[Define to 1 if you have a C99 compliant `vsnprintf' function.])],
[AC_DEFINE([vsnprintf], [rpl_vsnprintf],
[Define to rpl_vsnprintf if the replacement function should be used.])
AC_CHECK_HEADERS([inttypes.h locale.h stddef.h stdint.h])
AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep],
[], [], [#include <locale.h>])
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_SIZE_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_FUNCS([localeconv])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_VSNPRINTF
# HW_FUNC_SNPRINTF
# ----------------
# Set $hw_cv_func_snprintf and $hw_cv_func_snprintf_c99 to "yes" or "no",
# respectively. Define HAVE_SNPRINTF to 1 only if $hw_cv_func_snprintf_c99
# is set to "yes". Otherwise, define snprintf to rpl_snprintf and make sure
# the replacement function will be built.
AC_DEFUN([HW_FUNC_SNPRINTF],
[
AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our snprintf(3) calls vsnprintf(3).
AC_CHECK_FUNC([snprintf],
[hw_cv_func_snprintf=yes],
[hw_cv_func_snprintf=no])
AS_IF([test "$hw_cv_func_snprintf" = yes],
[AC_CACHE_CHECK([whether snprintf is C99 compliant],
[hw_cv_func_snprintf_c99],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[#include <stdio.h>]],
[[char buf[43];
if (snprintf(buf, 4, "The answer is %27.2g.", 42.0) != 42 ||
snprintf(buf, 0, "No, it's %32zu.", (size_t)42) != 42 ||
buf[0] != 'T' || buf[3] != '\0')
return 1;]])],
[hw_cv_func_snprintf_c99=yes],
[hw_cv_func_snprintf_c99=no],
[hw_cv_func_snprintf_c99=no])])],
[hw_cv_func_snprintf_c99=no])
AS_IF([test "$hw_cv_func_snprintf_c99" = yes],
[AC_DEFINE([HAVE_SNPRINTF], [1],
[Define to 1 if you have a C99 compliant `snprintf' function.])],
[AC_DEFINE([snprintf], [rpl_snprintf],
[Define to rpl_snprintf if the replacement function should be used.])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_SNPRINTF
# HW_FUNC_VASPRINTF
# -----------------
# Set $hw_cv_func_vasprintf to "yes" or "no". Define HAVE_VASPRINTF to 1 if
# $hw_cv_func_vasprintf is set to "yes". Otherwise, define vasprintf to
# rpl_vasprintf and make sure the replacement function will be built.
AC_DEFUN([HW_FUNC_VASPRINTF],
[
AC_REQUIRE([HW_FUNC_VSNPRINTF])dnl Our vasprintf(3) calls vsnprintf(3).
AC_CHECK_FUNCS([vasprintf],
[hw_cv_func_vasprintf=yes],
[hw_cv_func_vasprintf=no])
AS_IF([test "$hw_cv_func_vasprintf" = no],
[AC_DEFINE([vasprintf], [rpl_vasprintf],
[Define to rpl_vasprintf if the replacement function should be used.])
AC_CHECK_HEADERS([stdlib.h])
HW_FUNC_VA_COPY
AS_IF([test "$hw_cv_func_va_copy" = no],
[HW_FUNC___VA_COPY])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_VASPRINTF
# HW_FUNC_ASPRINTF
# ----------------
# Set $hw_cv_func_asprintf to "yes" or "no". Define HAVE_ASPRINTF to 1 if
# $hw_cv_func_asprintf is set to "yes". Otherwise, define asprintf to
# rpl_asprintf and make sure the replacement function will be built.
AC_DEFUN([HW_FUNC_ASPRINTF],
[
AC_REQUIRE([HW_FUNC_VASPRINTF])dnl Our asprintf(3) calls vasprintf(3).
AC_CHECK_FUNCS([asprintf],
[hw_cv_func_asprintf=yes],
[hw_cv_func_asprintf=no])
AS_IF([test "$hw_cv_func_asprintf" = no],
[AC_DEFINE([asprintf], [rpl_asprintf],
[Define to rpl_asprintf if the replacement function should be used.])
_HW_FUNC_XPRINTF_REPLACE])
])# HW_FUNC_ASPRINTF
# _HW_FUNC_XPRINTF_REPLACE
# ------------------------
# Arrange for building snprintf.c. Must be called if one or more of the
# functions provided by snprintf.c are needed.
AC_DEFUN([_HW_FUNC_XPRINTF_REPLACE],
[
AS_IF([test "x$_hw_cv_func_xprintf_replace_done" != xyes],
[AC_C_CONST
HW_HEADER_STDARG_H
AC_LIBOBJ([snprintf])
_hw_cv_func_xprintf_replace_done=yes])
])# _HW_FUNC_XPRINTF_REPLACE
dnl vim: set joinspaces textwidth=80:
#ifndef _COMPAT_H
#define _COMPAT_H 1
#include <stdarg.h>
int vasprintf(char **strp, const char *format, va_list ap);
#endif /* _COMPAT_H */
......@@ -17,14 +17,34 @@
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Define for some functions we are interested in */
#undef HAVE_FSEEKO
#undef HAVE_VSNPRINTF
#undef HAVE_SNPRINTF
#undef HAVE_VASPRINTF
#undef HAVE_ASPRINTF
#undef HAVE_FSEEKO
#undef HAVE_STDARG_H
#undef HAVE_STDDEF_H
#undef HAVE_STDINT_H
#undef HAVE_STDLIB_H
#undef HAVE_INTTYPES_H
#undef HAVE_LOCALE_H
#undef HAVE_LOCALECONV
#undef HAVE_LCONV_DECIMAL_POINT
#undef HAVE_LCONV_THOUSANDS_SEP
#undef HAVE_LONG_DOUBLE
#undef HAVE_LONG_LONG_INT
#undef HAVE_UNSIGNED_LONG_LONG_INT
#undef HAVE_INTMAX_T
#undef HAVE_UINTMAX_T
#undef HAVE_UINTPTR_T
#undef HAVE_PTRDIFF_T
#undef HAVE_VA_COPY
#undef HAVE___VA_COPY
/* Define if the GNU dcgettext() function is already present or
preinstalled. */
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
......
......@@ -10190,7 +10190,7 @@ rt_pg_error(const char *fmt, va_list ap)
char errmsg[ERRMSG_MAXLEN+1];
vsnprintf (errmsg, ERRMSG_MAXLEN, fmt, ap);
lw_vsnprintf (errmsg, ERRMSG_MAXLEN, fmt, ap);
errmsg[ERRMSG_MAXLEN]='\0';
ereport(ERROR, (errmsg_internal("%s", errmsg)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment