summaryrefslogtreecommitdiff
path: root/src/free_cache.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-23 16:12:32 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-05-23 16:12:32 +0000
commit2107bfbc19c3ea9b60adf575eb528e4e236ca8fe (patch)
treeac02996fbc0d823e5535bf88e3a01ee8f9bfd8cd /src/free_cache.c
parent3eb219a24f100bcd97e77c3be9a0b59f1ed211a2 (diff)
downloadmpfr-2107bfbc19c3ea9b60adf575eb528e4e236ca8fe.tar.gz
Added shared cache support (from a patch by Patrick PĂ©lissier).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10327 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/free_cache.c')
-rw-r--r--src/free_cache.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/free_cache.c b/src/free_cache.c
index e2baa13c5..5ec926dd5 100644
--- a/src/free_cache.c
+++ b/src/free_cache.c
@@ -87,6 +87,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);
@@ -98,4 +99,32 @@ mpfr_free_cache (void)
#endif
mpfr_clear_cache (__gmpfr_cache_const_euler);
mpfr_clear_cache (__gmpfr_cache_const_catalan);
+#endif
+}
+
+void
+mpfr_free_cache2(mpfr_free_cache_t way)
+{
+ switch (way) {
+ case MPFR_FREE_LOCAL_CACHE:
+ mpfr_free_cache();
+ 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
+ break;
+ default:
+ break;
+ }
}