pike.git / src / bignum.c

version» Context lines:

pike.git/src/bignum.c:4:      #include "interpret.h"   #include "program.h"   #include "object.h"   #include "svalue.h"   #include "error.h"      struct svalue auto_bignum_program = { T_INT };      int gmp_library_loaded=0; + int gmp_library_resolving=0;      static void resolve_auto_bignum_program(void)   {    if(auto_bignum_program.type == T_INT)    { -  +  gmp_library_resolving=1;    push_text("Gmp.bignum");    SAFE_APPLY_MASTER("resolv", 1);       if(sp[-1].type != T_FUNCTION)    error("Failed to resolv Gmp.mpz!\n");       auto_bignum_program=sp[-1];    sp--;    dmalloc_touch_svalue(sp); -  +  gmp_library_resolving=0;    }   }      struct program *get_auto_bignum_program(void)   {    resolve_auto_bignum_program();    return program_from_function(&auto_bignum_program);   }      struct program *get_auto_bignum_program_or_zero(void)   { -  if(!gmp_library_loaded) return 0; +  if(!gmp_library_loaded || gmp_library_resolving) return 0;    resolve_auto_bignum_program();    return program_from_function(&auto_bignum_program);   }      void exit_auto_bignum(void)   {    free_svalue(&auto_bignum_program);    auto_bignum_program.type=T_INT;   }   
pike.git/src/bignum.c:66:   }      int is_bignum_object(struct object *o)   {    /* Note:    * This function should *NOT* try to resolv Gmp.mpz unless    * it is already loaded into memory.    * /Hubbe    */    -  if(!gmp_library_loaded) return 0; /* not possible */ +  if(!gmp_library_loaded || gmp_library_resolving) +  return 0; /* not possible */       resolve_auto_bignum_program();    return o->prog == program_from_function(&auto_bignum_program);   }      int is_bignum_object_in_svalue(struct svalue *sv)   {    return sv->type == T_OBJECT && is_bignum_object(sv->u.object);   }