From 0e6f46b001a02238a378743c4dd30583fe8e04b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Mon, 29 Nov 1999 23:41:24 -0800
Subject: [PATCH] bugfix for static linking (I hope)

Rev: src/bignum.c:1.15
Rev: src/modules/Gmp/mpz_glue.c:1.69
---
 src/bignum.c               |  4 ++--
 src/modules/Gmp/mpz_glue.c | 13 ++++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/bignum.c b/src/bignum.c
index 6405eb9e61..ab0a099933 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -41,7 +41,7 @@ struct program *get_auto_bignum_program_or_zero(void)
 {
   if(!gmp_library_loaded ||
      gmp_library_resolving  ||
-     !get_master()) return 0;
+     !master_object) return 0;
   resolve_auto_bignum_program();
   return program_from_function(&auto_bignum_program);
 }
@@ -80,7 +80,7 @@ int is_bignum_object(struct object *o)
 
   if(!gmp_library_loaded ||
      gmp_library_resolving ||
-    !get_master())
+     !master_object)
     return 0; /* not possible */
  
   resolve_auto_bignum_program();
diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c
index e937834f27..7a5035290e 100644
--- a/src/modules/Gmp/mpz_glue.c
+++ b/src/modules/Gmp/mpz_glue.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: mpz_glue.c,v 1.68 1999/11/23 23:04:13 hubbe Exp $");
+RCSID("$Id: mpz_glue.c,v 1.69 1999/11/30 07:41:24 hubbe Exp $");
 #include "gmp_machine.h"
 
 #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2)
@@ -181,6 +181,13 @@ static void get_new_mpz(MP_INT *tmp, struct svalue *s)
 
 static void mpzmod_create(INT32 args)
 {
+#ifdef AUTO_BIGNUM
+  /* Alert bignum.c that we have been loaded /Hubbe */
+  extern int gmp_library_loaded;
+  if(THIS_PROGRAM == bignum_program)
+    gmp_library_loaded=1;
+#endif
+    
   switch(args)
   {
   case 1:
@@ -1364,7 +1371,6 @@ void pike_module_init(void)
 #ifdef AUTO_BIGNUM
   {
     int id;
-    extern int gmp_library_loaded;
 
     /* This program autoconverts to integers, Gmp.mpz does not!!
      * magic? no, just an if statement :)              /Hubbe
@@ -1384,9 +1390,6 @@ void pike_module_init(void)
     id=add_program_constant("bignum", bignum_program=end_program(), 0);
     bignum_program->flags |= PROGRAM_NO_WEAK_FREE|PROGRAM_NO_EXPLICIT_DESTRUCT;
     
-    /* Alert bignum.c that we have been loaded /Hubbe */
-    gmp_library_loaded=1;
-
 #if 0
     /* magic /Hubbe
      * This seems to break more than it fixes though... /Hubbe
-- 
GitLab