summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-19 20:24:30 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-19 20:24:30 +0000
commit5785a9ac39e7742d6b593b330dbb12a75f88cdfc (patch)
tree84ddd006d4137b0e458e57284679cfa70401f3c6 /Build
parent39b18baf27f6064d527e0eef7efc6ed8b8002e33 (diff)
mplibdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@45335 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w2
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathbinary.w42
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathdecimal.w9
3 files changed, 31 insertions, 22 deletions
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index c0682ed6715..dbdf5a0b930 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -1,3 +1,5 @@
+% $Id: mp.w 2137 2017-09-19 19:01:58Z luigi.scarso@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.
diff --git a/Build/source/texk/web2c/mplibdir/mpmathbinary.w b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
index b15b7983685..c6df9ced4c8 100644
--- a/Build/source/texk/web2c/mplibdir/mpmathbinary.w
+++ b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
@@ -221,31 +221,37 @@ static mpfr_t fraction_one_plus_mpfr_t;
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
diff --git a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
index aa86e2b650f..6503b8320fe 100644
--- a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
+++ b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
@@ -608,10 +608,11 @@ void mp_free_decimal_math (MP mp) {
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);
}