[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 1d84e65: Fix bignum initialization
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 1d84e65: Fix bignum initialization |
Date: |
Tue, 4 Sep 2018 12:31:58 -0400 (EDT) |
branch: master
commit 1d84e6523250ab6d14f40fba3922c56d7a40416f
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix bignum initialization
Problem reported by Andy Moreton in:
https://lists.gnu.org/r/emacs-devel/2018-09/msg00072.html
and crystal-ball diagnosis by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-09/msg00075.html
* src/alloc.c (xrealloc_for_gmp, xfree_for_gmp): Move to bignum.c.
(init_alloc): Move bignum initialization to init_bignum.
* src/bignum.c (init_bignum): Rename from init_bignum_once.
All users changed.
* src/emacs.c (main): Call init_bignum after init_alloc,
instead of calling init_bignum_once after init_bignum.
---
src/alloc.c | 16 ----------------
src/bignum.c | 18 +++++++++++++++++-
src/bignum.h | 2 +-
src/emacs.c | 2 +-
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 1eab82d..28ca780 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7126,18 +7126,6 @@ range_error (void)
xsignal0 (Qrange_error);
}
-static void *
-xrealloc_for_gmp (void *ptr, size_t ignore, size_t size)
-{
- return xrealloc (ptr, size);
-}
-
-static void
-xfree_for_gmp (void *ptr, size_t ignore)
-{
- xfree (ptr);
-}
-
/* Initialization. */
void
@@ -7171,10 +7159,6 @@ init_alloc_once (void)
void
init_alloc (void)
{
- eassert (mp_bits_per_limb == GMP_NUMB_BITS);
- integer_width = 1 << 16;
- mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp);
-
Vgc_elapsed = make_float (0.0);
gcs_done = 0;
diff --git a/src/bignum.c b/src/bignum.c
index 2ce7412..35894f5 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -34,9 +34,25 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
mpz_t mpz[4];
+static void *
+xrealloc_for_gmp (void *ptr, size_t ignore, size_t size)
+{
+ return xrealloc (ptr, size);
+}
+
+static void
+xfree_for_gmp (void *ptr, size_t ignore)
+{
+ xfree (ptr);
+}
+
void
-init_bignum_once (void)
+init_bignum (void)
{
+ eassert (mp_bits_per_limb == GMP_NUMB_BITS);
+ integer_width = 1 << 16;
+ mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp);
+
for (int i = 0; i < ARRAYELTS (mpz); i++)
mpz_init (mpz[i]);
}
diff --git a/src/bignum.h b/src/bignum.h
index 07622a3..0e38c61 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -43,7 +43,7 @@ struct Lisp_Bignum
extern mpz_t mpz[4];
-extern void init_bignum_once (void);
+extern void init_bignum (void);
extern Lisp_Object make_integer_mpz (void);
extern void mpz_set_intmax_slow (mpz_t, intmax_t) ARG_NONNULL ((1));
diff --git a/src/emacs.c b/src/emacs.c
index 5b399ec..b1c96d1 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1209,7 +1209,6 @@ Using an Emacs configured with --with-x-toolkit=lucid
does not have this problem
if (!initialized)
{
init_alloc_once ();
- init_bignum_once ();
init_threads_once ();
init_obarray ();
init_eval_once ();
@@ -1257,6 +1256,7 @@ Using an Emacs configured with --with-x-toolkit=lucid
does not have this problem
}
init_alloc ();
+ init_bignum ();
init_threads ();
if (do_initial_setlocale)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 1d84e65: Fix bignum initialization,
Paul Eggert <=