diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /misc/efgcvt.c | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2 glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'misc/efgcvt.c')
-rw-r--r-- | misc/efgcvt.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/misc/efgcvt.c b/misc/efgcvt.c index 915d00dfd5..b9fb4a9b71 100644 --- a/misc/efgcvt.c +++ b/misc/efgcvt.c @@ -1,5 +1,6 @@ /* Compatibility functions for floating point formatting. - Copyright (C) 1995, 1996, 1997, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999, 2002, 2006 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,6 +24,7 @@ #include <sys/param.h> #include <float.h> #include <bits/libc-lock.h> +#include <math_ldbl_opt.h> #ifndef FLOAT_TYPE # define FLOAT_TYPE double @@ -44,10 +46,14 @@ # error "NDIGIT_MAX must be precomputed" # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0))) # endif +#else +# define LONG_DOUBLE_CVT #endif #define APPEND(a, b) APPEND2 (a, b) #define APPEND2(a, b) a##b +#define __APPEND(a, b) __APPEND2 (a, b) +#define __APPEND2(a, b) __##a##b #define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer) @@ -60,14 +66,14 @@ static char ECVT_BUFFER[MAXDIG]; libc_freeres_ptr (static char *FCVT_BUFPTR); char * -APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) +__APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) FLOAT_TYPE value; int ndigit, *decpt, *sign; { if (FCVT_BUFPTR == NULL) { - if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFFER, MAXDIG) != -1) + if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, + FCVT_BUFFER, MAXDIG) != -1) return FCVT_BUFFER; FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG); @@ -75,26 +81,26 @@ APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign) return FCVT_BUFFER; } - (void) APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFPTR, FCVT_MAXDIG); + (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, + FCVT_BUFPTR, FCVT_MAXDIG); return FCVT_BUFPTR; } char * -APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) +__APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign) FLOAT_TYPE value; int ndigit, *decpt, *sign; { - (void) APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, - ECVT_BUFFER, MAXDIG); + (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, + ECVT_BUFFER, MAXDIG); return ECVT_BUFFER; } char * -APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) +__APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) FLOAT_TYPE value; int ndigit; char *buf; @@ -102,3 +108,26 @@ APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf) sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value); return buf; } + +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +# ifdef LONG_DOUBLE_CVT +# define cvt_symbol(symbol) \ + cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ + APPEND (FUNC_PREFIX, symbol), GLIBC_2_4) +# define cvt_symbol_1(lib, local, symbol, version) \ + versioned_symbol (lib, local, symbol, version) +# else +# define cvt_symbol(symbol) \ + cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \ + APPEND (q, symbol), GLIBC_2_0); \ + strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) +# define cvt_symbol_1(lib, local, symbol, version) \ + compat_symbol (lib, local, symbol, version) +# endif +#else +# define cvt_symbol(symbol) \ + strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol)) +#endif +cvt_symbol(fcvt); +cvt_symbol(ecvt); +cvt_symbol(gcvt); |