From: Simon Josefsson Date: Fri, 19 Sep 2008 12:26:03 +0000 (+0200) Subject: Update gnulib files. X-Git-Tag: gnutls_2_5_8~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c21394964bac17cc5110e69329e92a0b402c4bc;p=thirdparty%2Fgnutls.git Update gnulib files. --- diff --git a/gl/gnulib.mk b/gl/gnulib.mk index 4f3bb9664d..c441e6c68c 100644 --- a/gl/gnulib.mk +++ b/gl/gnulib.mk @@ -223,15 +223,6 @@ EXTRA_DIST += stdarg.in.h ## end gnulib module stdarg -## begin gnulib module strdup - - -EXTRA_DIST += strdup.c - -EXTRA_libgnu_la_SOURCES += strdup.c - -## end gnulib module strdup - ## begin gnulib module strerror diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 384a942f39..8535ef6665 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -79,8 +79,6 @@ AC_DEFUN([gl_INIT], gl_FUNC_READLINE gl_TYPE_SOCKLEN_T gl_STDARG_H - gl_FUNC_STRDUP - gl_STRING_MODULE_INDICATOR([strdup]) gl_FUNC_STRERROR gl_STRING_MODULE_INDICATOR([strerror]) m4_ifval(gl_LIBSOURCES_LIST, [ @@ -239,7 +237,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/readline.c lib/readline.h lib/stdarg.in.h - lib/strdup.c lib/strerror.c lib/version-etc-fsf.c lib/version-etc.c @@ -263,7 +260,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/readline.m4 m4/socklen.m4 m4/stdarg.m4 - m4/strdup.m4 m4/strerror.m4 tests/test-arpa_inet.c tests/test-c-ctype.c diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4 deleted file mode 100644 index 8796e9e02f..0000000000 --- a/gl/m4/strdup.m4 +++ /dev/null @@ -1,22 +0,0 @@ -# strdup.m4 serial 9 - -dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software -dnl Foundation, Inc. - -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_FUNC_STRDUP], -[ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - AC_REPLACE_FUNCS(strdup) - AC_CHECK_DECLS_ONCE(strdup) - if test $ac_cv_have_decl_strdup = no; then - HAVE_DECL_STRDUP=0 - fi - gl_PREREQ_STRDUP -]) - -# Prerequisites of lib/strdup.c. -AC_DEFUN([gl_PREREQ_STRDUP], [:]) diff --git a/gl/strdup.c b/gl/strdup.c deleted file mode 100644 index bebe5c8fb4..0000000000 --- a/gl/strdup.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free - Software Foundation, Inc. - - This file is part of the GNU C Library. - - 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 3, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _LIBC -# include -#endif - -/* Get specification. */ -#include - -#include - -#undef __strdup -#ifdef _LIBC -# undef strdup -#endif - -#ifndef weak_alias -# define __strdup strdup -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -char * -__strdup (const char *s) -{ - size_t len = strlen (s) + 1; - void *new = malloc (len); - - if (new == NULL) - return NULL; - - return (char *) memcpy (new, s, len); -} -#ifdef libc_hidden_def -libc_hidden_def (__strdup) -#endif -#ifdef weak_alias -weak_alias (__strdup, strdup) -#endif diff --git a/lgl/vasnprintf.c b/lgl/vasnprintf.c index f66047f953..68cc2acf47 100644 --- a/lgl/vasnprintf.c +++ b/lgl/vasnprintf.c @@ -215,7 +215,7 @@ local_wcslen (const wchar_t *s) #undef remainder #define remainder rem -#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL +#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined # define decimal_point_char_defined 1 @@ -255,11 +255,11 @@ is_infinite_or_zero (double x) #if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL -/* Equivalent to !isfinite(x), but does not require libm. */ +/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ static int -is_infinitel (long double x) +is_infinite_or_zerol (long double x) { - return isnanl (x) || (x + x == x && x != 0.0L); + return isnanl (x) || x + x == x; } #endif @@ -2578,8 +2578,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, # elif NEED_PRINTF_INFINITE_LONG_DOUBLE || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE /* Some systems produce wrong output for Inf, - -Inf, and NaN. */ - && is_infinitel (a.arg[dp->arg_index].a.a_longdouble)) + -Inf, and NaN. Some systems in this category + (IRIX 5.3) also do so for -0.0. Therefore we + treat this case here as well. */ + && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) # endif )) { @@ -3139,7 +3141,49 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, abort (); # else /* arg is finite. */ - abort (); + if (!(arg == 0.0L)) + abort (); + + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + *p++ = dp->conversion; /* 'e' or 'E' */ + *p++ = '+'; + *p++ = '0'; + *p++ = '0'; + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + *p++ = '0'; + if (flags & FLAG_ALT) + { + size_t ndigits = + (precision > 0 ? precision - 1 : 0); + *p++ = decimal_point_char (); + for (; ndigits > 0; --ndigits) + *p++ = '0'; + } + } + else + abort (); # endif }