X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fftoastr.c;h=7c99ef00f385129e8f3b32cad3ee8c5ce378703f;hb=3b50d1963aa9a19cf75a6fe8950d8647d1232105;hp=a55b24eb94fa3c4766501ae1adba72ab926e629f;hpb=5ea438b5d354059846385a90f2f7f39e55d64bc4;p=gnulib.git diff --git a/lib/ftoastr.c b/lib/ftoastr.c index a55b24eb9..7c99ef00f 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c @@ -1,6 +1,6 @@ /* floating point to accurate string - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2011 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 @@ -40,14 +40,15 @@ # define FLOAT_MIN LDBL_MIN # define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND # define FTOASTR ldtoastr -# define STRTOF strtold +# if HAVE_C99_STRTOLD +# define STRTOF strtold +# endif #elif LENGTH == 2 # define FLOAT double # define FLOAT_DIG DBL_DIG # define FLOAT_MIN DBL_MIN # define FLOAT_PREC_BOUND _GL_DBL_PREC_BOUND # define FTOASTR dtoastr -# define STRTOF strtod #else # define LENGTH 1 # define FLOAT float @@ -55,21 +56,22 @@ # define FLOAT_MIN FLT_MIN # define FLOAT_PREC_BOUND _GL_FLT_PREC_BOUND # define FTOASTR ftoastr -# define STRTOF strtof +# if HAVE_STRTOF +# define STRTOF strtof +# endif #endif /* On pre-C99 hosts, approximate strtof and strtold with strtod. This may generate one or two extra digits, but that's better than not - working at all. Assume that strtof works if strtold does. */ -#if LENGTH != 2 && ! HAVE_C99_STRTOLD -# undef STRTOF + working at all. */ +#ifndef STRTOF # define STRTOF strtod #endif /* On hosts where it's not known that snprintf works, use sprintf to implement the subset needed here. Typically BUFSIZE is big enough and there's little or no performance hit. */ -#if ! GNULIB_SNPRINTF_POSIX +#if ! GNULIB_SNPRINTF # undef snprintf # define snprintf ftoastr_snprintf static int