Code changes after ./configure in GNU MP library

Viewed 15

I was installing GNU MP library and before that I kept a copy of the files. Following the instructions I typed commands ./configure and make && make install sequentially and succeeded. However, comparing the two sets of source code intuitively, I found a new file gmp.h appeared though I supposed it was a makefile command stuff. Then I compared two files init.c in mpz folder, the contents are in the following:

#include "gmp-impl.h"

void
mpz_init (mpz_ptr x) __GMP_NOTHROW
{
  static const mp_limb_t dummy_limb=0xc1a0;
  ALLOC (x) = 0;
  PTR (x) = (mp_ptr) &dummy_limb;
  SIZ (x) = 0;
}

After doing install construtions:

#include "gmp.h"
#include "gmp-impl.h"

void
mpz_init (mpz_ptr x)
{
  ALLOC (x) = 1;
  PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
  SIZ (x) = 0;

#ifdef __CHECKER__
  /* let the low limb look initialized, for the benefit of mpz_get_ui etc */
  PTR (x)[0] = 0;
#endif
}

So many codes have changed! Especially I noticed that the assignment ALLOC(X) converts to 0 from 1. I make a demo.c to test it:

#include <gmp.h>
#include<stdio.h>
#include <string.h>

int main(int argc, const char *argv[])
{
  mpz_t r;
  mpz_init(r);
  printf("%d\n",r->_mp_alloc);
}

The output is:

0

Could anybody tell me what accounts for this?

0 Answers
Related