From d96f41a2fb04e3baf6659d6fafcbd65d69640c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Pe=C3=B1aranda?= Date: Wed, 23 Dec 2009 12:01:58 +0000 Subject: [PATCH] eliminated code related to the handling of RS allocators (now done automatically inside the library) --- Algebraic_kernel_d/dont_submit | 1 + .../include/CGAL/RS/polynomial_1.h | 13 ------- .../include/CGAL/RS/polynomial_1_member.h | 31 ---------------- .../include/CGAL/RS/polynomial_1_utils.h | 30 --------------- .../include/CGAL/RS/polynomial_converter.h | 3 -- Algebraic_kernel_d/include/CGAL/RS/solve_1.h | 37 ------------------- 6 files changed, 1 insertion(+), 114 deletions(-) diff --git a/Algebraic_kernel_d/dont_submit b/Algebraic_kernel_d/dont_submit index 357409ac839..a5d927ba298 100644 --- a/Algebraic_kernel_d/dont_submit +++ b/Algebraic_kernel_d/dont_submit @@ -1 +1,2 @@ +include/CGAL/RS/memory.h include/CGAL/RS/refine_1.h diff --git a/Algebraic_kernel_d/include/CGAL/RS/polynomial_1.h b/Algebraic_kernel_d/include/CGAL/RS/polynomial_1.h index da032cbf659..4f73e689f60 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/polynomial_1.h +++ b/Algebraic_kernel_d/include/CGAL/RS/polynomial_1.h @@ -30,9 +30,6 @@ #include #include #include -#ifdef CGAL_USE_OLD_RS3 -# include -#endif namespace CGAL{ @@ -63,13 +60,6 @@ class RS_polynomial_1: void *(*_allocf)(size_t); void *(*_reallocf)(void*,size_t,size_t); void (*_freef)(void*,size_t); -#ifdef CGAL_USE_OLD_RS3 - // in case of using rs3, _gc_address stores the - // address of the memory zone used to allocate this - // polynomial (which is generally one of the two - // garbage collectors, rs2 or rs3) - gc_session *_gc_address; -#endif void fetch_gmp_functions(); public: // copy constructor and copy assignement operator @@ -140,9 +130,6 @@ class RS_polynomial_1: templateRS_polynomial_1& operator*=(const T&); templateRS_polynomial_1& operator/=(const T&); templateRS_polynomial_1 operator/(const T&)const; -#ifdef CGAL_USE_OLD_RS3 - gc_session *get_gc_address() const; -#endif }; } // namespace CGAL diff --git a/Algebraic_kernel_d/include/CGAL/RS/polynomial_1_member.h b/Algebraic_kernel_d/include/CGAL/RS/polynomial_1_member.h index 572022e4cf0..41d68feb702 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/polynomial_1_member.h +++ b/Algebraic_kernel_d/include/CGAL/RS/polynomial_1_member.h @@ -32,28 +32,14 @@ void RS_polynomial_1::create_storage(int size){ inline void RS_polynomial_1::free_storage(){ -#ifdef CGAL_USE_OLD_RS3 - gc_session *old_address; -#endif void *(*af)(size_t); void *(*rf)(void*,size_t,size_t); void (*ff)(void*,size_t); mp_get_memory_functions(&af,&rf,&ff); mp_set_memory_functions(_allocf,_reallocf,_freef); -#ifdef CGAL_USE_OLD_RS3 - old_address=_gc_address; - //std::cout<<"set _gc_address to "<<_gc_address< #include #include -#ifdef CGAL_USE_OLD_RS3 -extern "C"{ -# define RS_I32 int -# include -# ifdef CGAL_USE_RS3 -# include -# endif -} -# include -#endif namespace CGAL{ @@ -48,9 +38,6 @@ public std::binary_function{ const RS_polynomial_1 &p2)const{ int dr,d1,d2; mpz_t * r_z; -#ifdef CGAL_USE_OLD_RS3 - init_rs3(); -#endif d1=p1.get_degree(); d2=p2.get_degree(); dr=rs3_up_mz_gcd( @@ -60,13 +47,6 @@ public std::binary_function{ (const mpz_t*)p2.get_coefs(), d2); RS_polynomial_1 *result=new RS_polynomial_1(&r_z,dr); -#ifdef CGAL_USE_OLD_RS3 - done_with_rs3(); - mp_set_memory_functions( - __cgalrs_allocate_func, - __cgalrs_reallocate_func, - __cgalrs_free_func); -#endif return *result; } }; @@ -392,21 +372,11 @@ public std::unary_function{ if(P.get_degree()){ int d_sfp; mpz_t* sfp_z; -#ifdef CGAL_USE_OLD_RS3 - init_rs3(); -#endif d_sfp=rs3_up_mz_sfp( &sfp_z, (const mpz_t*)P.get_coefs(), P.get_degree()); RS_polynomial_1 *result=new RS_polynomial_1(&sfp_z,d_sfp); -#ifdef CGAL_USE_OLD_RS3 - done_with_rs3(); - mp_set_memory_functions( - __cgalrs_allocate_func, - __cgalrs_reallocate_func, - __cgalrs_free_func); -#endif return result; }else return (new RS_polynomial_1( diff --git a/Algebraic_kernel_d/include/CGAL/RS/polynomial_converter.h b/Algebraic_kernel_d/include/CGAL/RS/polynomial_converter.h index 38dbc6003b3..aec95ec7f10 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/polynomial_converter.h +++ b/Algebraic_kernel_d/include/CGAL/RS/polynomial_converter.h @@ -21,9 +21,6 @@ #include #include -#ifdef CGAL_USE_OLD_RS3 -# include -#endif namespace CGAL{ diff --git a/Algebraic_kernel_d/include/CGAL/RS/solve_1.h b/Algebraic_kernel_d/include/CGAL/RS/solve_1.h index 909d3cfb92a..5a1810b801b 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/solve_1.h +++ b/Algebraic_kernel_d/include/CGAL/RS/solve_1.h @@ -29,11 +29,6 @@ #include #include #include -#ifdef CGAL_USE_OLD_RS3 -# include -# define RS_I32 int -# include -#endif namespace CGAL{ @@ -53,34 +48,6 @@ inline void init_solver(){ } } -#ifdef CGAL_USE_OLD_RS3 -inline void init_rs3(){ - static bool first=true; - if(first){ - first=false; - init_solver(); - rs_set_usr_memory_fncts - (rs3_rs_alloc,rs3_rs_realloc,rs3_rs_free); - mp_set_memory_functions - (rs3_rs_alloc,rs3_rs_gmp_realloc,rs3_rs_gmp_free); - set_gc_session(&rs3_gc_session); - rs_internal_init(); - }else{ - rs_set_usr_memory_fncts - (rs3_rs_alloc,rs3_rs_realloc,rs3_rs_free); - mp_set_memory_functions - (rs3_rs_alloc,rs3_rs_gmp_realloc,rs3_rs_gmp_free); - set_gc_session(&rs3_gc_session); - rs_internal_reset(); - } -} - -inline void done_with_rs3(){ - mp_set_memory_functions(RS_gmpalloc,RS_gmprealloc,RS_gmpfree); - set_gc_session(&rs_default_gc_session); -} -#endif - // reset RS memory inline void reset_solver(){ rs_reset_all(); @@ -192,10 +159,6 @@ inline int solve_1( mpfi_ptr *x, const RS_polynomial_1 &p1, unsigned int prec=CGAL_RS_DEF_PREC){ -#ifdef CGAL_USE_OLD_RS3 - set_gc_session(p1.get_gc_address()); - //set_gc_session(&rs3_gc_session); -#endif rs_reset_all(); create_rs_upoly(p1.get_coefs(),p1.get_degree(),rs_get_default_up()); set_rs_precisol(prec);