[BACK]Return to realloc.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpz

Diff for /OpenXM_contrib/gmp/mpz/Attic/realloc.c between version 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2000/09/09 14:12:56 version 1.1.1.3, 2003/08/25 16:06:33
Line 1 
Line 1 
 /* _mpz_realloc -- make the mpz_t have NEW_SIZE digits allocated.  /* _mpz_realloc -- make the mpz_t have NEW_ALLOC digits allocated.
   
 Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.  Copyright 1991, 1993, 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
   
 This file is part of the GNU MP Library.  This file is part of the GNU MP Library.
   
Line 23  MA 02111-1307, USA. */
Line 23  MA 02111-1307, USA. */
 #include "gmp-impl.h"  #include "gmp-impl.h"
   
 void *  void *
 #if __STDC__  _mpz_realloc (mpz_ptr m, mp_size_t new_alloc)
 _mpz_realloc (mpz_ptr m, mp_size_t new_size)  
 #else  
 _mpz_realloc (m, new_size)  
      mpz_ptr m;  
      mp_size_t new_size;  
 #endif  
 {  {
     mp_ptr mp;
   
   /* Never allocate zero space. */    /* Never allocate zero space. */
   if (new_size == 0)    new_alloc = MAX (new_alloc, 1);
     new_size = 1;  
   
   m->_mp_d = (mp_ptr) (*_mp_reallocate_func) (m->_mp_d,    mp = __GMP_REALLOCATE_FUNC_LIMBS (PTR(m), ALLOC(m), new_alloc);
                                               m->_mp_alloc * BYTES_PER_MP_LIMB,    PTR(m) = mp;
                                               new_size * BYTES_PER_MP_LIMB);    ALLOC(m) = new_alloc;
   m->_mp_alloc = new_size;  
   
 #if 0    /* Don't create an invalid number; if the current value doesn't fit after
   /* This might break some code that reads the size field after       reallocation, clear it to 0.  */
      reallocation, in the case the reallocated destination and a    if (ABSIZ(m) > new_alloc)
      source argument are identical.  */      SIZ(m) = 0;
   if (ABS (m->_mp_size) > new_size)  
     m->_mp_size = 0;  
 #endif  
   
   return (void *) m->_mp_d;    return (void *) mp;
 }  }

Legend:
Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>