diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-05-23 22:41:26 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-05-23 22:41:26 +0000 |
commit | 9adad963e4a98b9e364aadd11b03941412d83b03 (patch) | |
tree | d96ac978b7f4a579203f311b2568bfda458d3bc1 /src/free_cache.c | |
parent | 4860e1f8c38c38bbfe010b69152c0414d772ace6 (diff) | |
download | mpfr-9adad963e4a98b9e364aadd11b03941412d83b03.tar.gz |
[src/free_cache.c] Avoid duplicated source code for maintainability.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10332 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/free_cache.c')
-rw-r--r-- | src/free_cache.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/free_cache.c b/src/free_cache.c index 76fad6c80..a7cd9dbbb 100644 --- a/src/free_cache.c +++ b/src/free_cache.c @@ -71,6 +71,22 @@ mpfr_mpz_clear (mpz_t z) #endif +static void +mpfr_free_const_caches (void) +{ +#ifndef MPFR_USE_LOGGING + mpfr_clear_cache (__gmpfr_cache_const_pi); + mpfr_clear_cache (__gmpfr_cache_const_log2); +#else + mpfr_clear_cache (__gmpfr_normal_pi); + mpfr_clear_cache (__gmpfr_normal_log2); + mpfr_clear_cache (__gmpfr_logging_pi); + mpfr_clear_cache (__gmpfr_logging_log2); +#endif + mpfr_clear_cache (__gmpfr_cache_const_euler); + mpfr_clear_cache (__gmpfr_cache_const_catalan); +} + void mpfr_free_cache (void) { @@ -88,17 +104,7 @@ mpfr_free_cache (void) #endif #if !defined (WANT_SHARED_CACHE) -# ifndef MPFR_USE_LOGGING - mpfr_clear_cache (__gmpfr_cache_const_pi); - mpfr_clear_cache (__gmpfr_cache_const_log2); -# else - mpfr_clear_cache (__gmpfr_normal_pi); - mpfr_clear_cache (__gmpfr_normal_log2); - mpfr_clear_cache (__gmpfr_logging_pi); - mpfr_clear_cache (__gmpfr_logging_log2); -# endif - mpfr_clear_cache (__gmpfr_cache_const_euler); - mpfr_clear_cache (__gmpfr_cache_const_catalan); + mpfr_free_const_caches (); #endif } @@ -112,18 +118,8 @@ mpfr_free_cache2 (mpfr_free_cache_t way) break; case MPFR_FREE_GLOBAL_CACHE: #if defined (WANT_SHARED_CACHE) -# ifndef MPFR_USE_LOGGING - mpfr_clear_cache (__gmpfr_cache_const_pi); - mpfr_clear_cache (__gmpfr_cache_const_log2); -# else - mpfr_clear_cache (__gmpfr_normal_pi); - mpfr_clear_cache (__gmpfr_normal_log2); - mpfr_clear_cache (__gmpfr_logging_pi); - mpfr_clear_cache (__gmpfr_logging_log2); -# endif - mpfr_clear_cache (__gmpfr_cache_const_euler); - mpfr_clear_cache (__gmpfr_cache_const_catalan); -# endif + mpfr_free_const_caches (); +#endif break; default: break; |