diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-06-08 09:53:48 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-06-08 09:53:48 +0000 |
commit | 621d7ffd3682b99ba21ba2f796c7cc9680b4b774 (patch) | |
tree | 111de3ed4033d552b4e2f09ed23edcf45bf861f8 | |
parent | 5ab31a6cfff0c816f35a8146e0aedcd1e80a78f5 (diff) | |
download | mpfr-621d7ffd3682b99ba21ba2f796c7cc9680b4b774.tar.gz |
Clean up use of stdio.h:
it is now included by mpfr-impl iff DEBUG is defined or WANT_ASSERT is
defined.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3631 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | add1sp.c | 19 | ||||
-rw-r--r-- | atan.c | 2 | ||||
-rw-r--r-- | clear.c | 12 | ||||
-rw-r--r-- | div.c | 2 | ||||
-rw-r--r-- | gamma.c | 5 | ||||
-rw-r--r-- | get_f.c | 1 | ||||
-rw-r--r-- | get_str.c | 7 | ||||
-rw-r--r-- | mpfr-impl.h | 5 | ||||
-rw-r--r-- | mul.c | 1 | ||||
-rw-r--r-- | round_p.c | 5 | ||||
-rw-r--r-- | set_z.c | 2 | ||||
-rw-r--r-- | sin.c | 2 | ||||
-rw-r--r-- | strtofr.c | 5 | ||||
-rw-r--r-- | sub1sp.c | 19 | ||||
-rw-r--r-- | subnormal.c | 1 | ||||
-rw-r--r-- | zeta.c | 5 |
16 files changed, 32 insertions, 61 deletions
@@ -21,20 +21,9 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined(DEBUG) || defined(WANT_ASSERT) -# include <stdio.h> -#endif - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -#ifdef DEBUG -# undef DEBUG -# define DEBUG(x) (x) -#else -# define DEBUG(x) /**/ -#endif - /* Check if we have to check the result of mpfr_add1sp with mpfr_add1 */ #ifdef WANT_ASSERT # if WANT_ASSERT >= 2 @@ -77,6 +66,14 @@ int mpfr_add1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) # endif #endif +/* Debugging support */ +#ifdef DEBUG +# undef DEBUG +# define DEBUG(x) (x) +#else +# define DEBUG(x) /**/ +#endif + /* compute sign(b) * (|b| + |c|) Returns 0 iff result is exact, a negative value when the result is less than the exact value, @@ -19,8 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -1,6 +1,6 @@ /* mpfr_clear -- free the memory space allocated for a floating-point number -Copyright 1999, 2000, 2001, 2004 Free Software Foundation. +Copyright 1999, 2000, 2001, 2004, 2005 Free Software Foundation. This file is part of the MPFR Library. @@ -19,16 +19,12 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "mpfr-impl.h" void mpfr_clear (mpfr_ptr m) { - /* be careful to always free an entire number of limbs */ - (*__gmp_free_func) - (MPFR_GET_REAL_PTR(m), - MPFR_MALLOC_SIZE(MPFR_GET_ALLOC_SIZE(m))); - MPFR_MANT(m) = NULL; + (*__gmp_free_func) (MPFR_GET_REAL_PTR (m), + MPFR_MALLOC_SIZE (MPFR_GET_ALLOC_SIZE (m))); + MPFR_MANT (m) = NULL; } @@ -24,7 +24,7 @@ MA 02110-1301, USA. */ #ifdef DEBUG #define mpn_print(ap,n) mpn_print3(ap,n,MPFR_LIMB_ZERO) -void +static void mpn_print3 (mp_ptr ap, mp_size_t n, mp_limb_t cy) { mp_size_t i; @@ -19,11 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef DEBUG -#include <stdio.h> -#include <stdlib.h> -#endif - /* The error analysis of gamma has been lost. As a consequence, we can't change the algorithm... But we may compute the exp(A-k) in the inner loop a lot faster @@ -19,7 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "mpfr-impl.h" /* return value is 0 iff no error occurred in the conversion @@ -20,11 +20,8 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <limits.h> +#include <string.h> /* For strlen */ +#include <limits.h> /* For LONG_MAX and LONG_MIN */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" diff --git a/mpfr-impl.h b/mpfr-impl.h index 7eea18546..ab30224c0 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -23,6 +23,11 @@ MA 02110-1301, USA. */ #ifndef __MPFR_IMPL_H__ #define __MPFR_IMPL_H__ +/* Include stdio.h iff we are debugging or we want to check */ +#if defined(DEBUG) || defined(WANT_ASSERT) +# include <stdio.h> +#endif + /* Check if we are inside a build of MPFR or inside the test suite. This is needed in mpfr.h to export or import the functions. It matters only for Windows DLL */ @@ -20,7 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -21,11 +21,10 @@ MA 02110-1301, USA. */ #include "mpfr-impl.h" +/* Check against mpfr_can_round ? */ #ifdef WANT_ASSERT # if WANT_ASSERT >= 2 -# include <stdio.h> -int -mpfr_round_p_2 (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mp_prec_t prec); +int mpfr_round_p_2 (mp_limb_t *, mp_size_t, mp_exp_t, mp_prec_t); int mpfr_round_p (mp_limb_t *bp, mp_size_t bn, mp_exp_t err0, mp_prec_t prec) { @@ -20,8 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -19,8 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -19,9 +19,8 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdlib.h> -#include <string.h> -#include <ctype.h> +#include <stdlib.h> /* For strtol */ +#include <ctype.h> /* For isdigit */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" @@ -21,20 +21,9 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined(DEBUG) || defined(WANT_ASSERT) -# include <stdio.h> -#endif - #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" -#ifdef DEBUG -# undef DEBUG -# define DEBUG(x) (x) -#else -# define DEBUG(x) /**/ -#endif - /* Check if we have to check the result of mpfr_sub1sp with mpfr_sub1 */ #ifdef WANT_ASSERT # if WANT_ASSERT >= 2 @@ -77,7 +66,13 @@ int mpfr_sub1sp (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) # endif #endif - +/* Debugging support */ +#ifdef DEBUG +# undef DEBUG +# define DEBUG(x) (x) +#else +# define DEBUG(x) /**/ +#endif /* Rounding Sub */ diff --git a/subnormal.c b/subnormal.c index 37aa85c02..b0dc12d51 100644 --- a/subnormal.c +++ b/subnormal.c @@ -20,7 +20,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "mpfr-impl.h" /* For GMP_RNDN, we can have a problem of double rounding. @@ -20,10 +20,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Place, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* #define DEBUG */ - -#include <stdio.h> -#include <limits.h> +#include <limits.h> /* For CHAR_BIT */ #define MPFR_NEED_LONGLONG_H #include "mpfr-impl.h" |