texlive[45335] Build/source/texk/web2c/mplibdir: mplibdir: sync with

commits+kakuto at tug.org commits+kakuto at tug.org
Tue Sep 19 22:24:31 CEST 2017


Revision: 45335
          http://tug.org/svn/texlive?view=revision&revision=45335
Author:   kakuto
Date:     2017-09-19 22:24:30 +0200 (Tue, 19 Sep 2017)
Log Message:
-----------
mplibdir: sync with the upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/mplibdir/mp.w
    trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w
    trunk/Build/source/texk/web2c/mplibdir/mpmathdecimal.w

Modified: trunk/Build/source/texk/web2c/mplibdir/mp.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mp.w	2017-09-19 00:17:48 UTC (rev 45334)
+++ trunk/Build/source/texk/web2c/mplibdir/mp.w	2017-09-19 20:24:30 UTC (rev 45335)
@@ -1,3 +1,5 @@
+% $Id: mp.w 2137 2017-09-19 19:01:58Z luigi.scarso at gmail.com $
+%
 % This file is part of MetaPost;
 % the MetaPost program is in the public domain.
 % See the <Show version...> code in mpost.w for more info.

Modified: trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w	2017-09-19 00:17:48 UTC (rev 45334)
+++ trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w	2017-09-19 20:24:30 UTC (rev 45335)
@@ -221,31 +221,37 @@
 static mpfr_t PI_mpfr_t;
 static mpfr_t epsilon_mpfr_t;
 static mpfr_t EL_GORDO_mpfr_t;
+static boolean initialized = false;
 
+
 @ @c
 void init_binary_constants (void) {
-  mpfr_inits2 (precision_bits, one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,
+  if (!initialized) {
+    mpfr_inits2 (precision_bits, one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,
               fraction_one_mpfr_t, fraction_one_plus_mpfr_t,  angle_multiplier_mpfr_t, PI_mpfr_t, 
               epsilon_mpfr_t, EL_GORDO_mpfr_t, (mpfr_ptr) 0);
-  mpfr_set_si (one, 1, ROUNDING);
-  mpfr_set_si (minusone, -1, ROUNDING);
-  mpfr_set_si (zero, 0, ROUNDING);
-  mpfr_set_si (two_mpfr_t, two, ROUNDING);
-  mpfr_set_si (three_mpfr_t, three, ROUNDING);
-  mpfr_set_si (four_mpfr_t, four, ROUNDING);
-  mpfr_set_si (fraction_multiplier_mpfr_t, fraction_multiplier, ROUNDING);
-  mpfr_set_si (fraction_one_mpfr_t, fraction_one, ROUNDING);
-  mpfr_set_si (fraction_one_plus_mpfr_t, (fraction_one+1), ROUNDING);
-  mpfr_set_si (angle_multiplier_mpfr_t, angle_multiplier, ROUNDING);
-  mpfr_set_str (PI_mpfr_t, PI_STRING, 10, ROUNDING);
-  mpfr_set_str (epsilon_mpfr_t, epsilon, 10, ROUNDING);
-  mpfr_set_str (EL_GORDO_mpfr_t, EL_GORDO, 10, ROUNDING);
+    mpfr_set_si (one, 1, ROUNDING);
+    mpfr_set_si (minusone, -1, ROUNDING);
+    mpfr_set_si (zero, 0, ROUNDING);
+    mpfr_set_si (two_mpfr_t, two, ROUNDING);
+    mpfr_set_si (three_mpfr_t, three, ROUNDING);
+    mpfr_set_si (four_mpfr_t, four, ROUNDING);
+    mpfr_set_si (fraction_multiplier_mpfr_t, fraction_multiplier, ROUNDING);
+    mpfr_set_si (fraction_one_mpfr_t, fraction_one, ROUNDING);
+    mpfr_set_si (fraction_one_plus_mpfr_t, (fraction_one+1), ROUNDING);
+    mpfr_set_si (angle_multiplier_mpfr_t, angle_multiplier, ROUNDING);
+    mpfr_set_str (PI_mpfr_t, PI_STRING, 10, ROUNDING);
+    mpfr_set_str (epsilon_mpfr_t, epsilon, 10, ROUNDING);
+    mpfr_set_str (EL_GORDO_mpfr_t, EL_GORDO, 10, ROUNDING);
+    initialized = true;
+  }
 }
 void free_binary_constants (void) {
-  mpfr_clears (one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,
-              fraction_one_mpfr_t, fraction_one_plus_mpfr_t,  angle_multiplier_mpfr_t, PI_mpfr_t, 
-              epsilon_mpfr_t, EL_GORDO_mpfr_t, (mpfr_ptr) 0);
-  mpfr_free_cache ();
+  /* For sake of speed, we accept this memory leak. */
+  /*mpfr_clears (one, minusone, zero, two_mpfr_t, three_mpfr_t, four_mpfr_t, fraction_multiplier_mpfr_t,*/
+  /*            fraction_one_mpfr_t, fraction_one_plus_mpfr_t,  angle_multiplier_mpfr_t, PI_mpfr_t, */
+  /*            epsilon_mpfr_t, EL_GORDO_mpfr_t, (mpfr_ptr) 0); */
+  /*mpfr_free_cache ();*/
 }
 
 @ |precision_max| is limited to 1000, because the precision of already initialized 

Modified: trunk/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpmathdecimal.w	2017-09-19 00:17:48 UTC (rev 45334)
+++ trunk/Build/source/texk/web2c/mplibdir/mpmathdecimal.w	2017-09-19 20:24:30 UTC (rev 45335)
@@ -608,10 +608,11 @@
   free_number (((math_data *)mp->math)->p_over_v_threshold_t);
   free_number (((math_data *)mp->math)->equation_threshold_t);
   free_number (((math_data *)mp->math)->tfm_warn_threshold_t);
-  for (i = 0; i <= last_cached_factorial; i++) {
-    free(factorials[i]);
-  }
-  free(factorials);
+  /* For sake of speed, we accept this memory leak. */
+  /* for (i = 0; i <= last_cached_factorial; i++) {*/
+  /*  free(factorials[i]);*/
+  /* }*/
+  /* free(factorials); */
   free(mp->math);
 }
 



More information about the tex-live-commits mailing list