File: gmp.c

package info (click to toggle)
gcl 2.6.14-21
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 60,864 kB
  • sloc: ansic: 177,407; lisp: 151,509; asm: 128,169; sh: 22,510; cpp: 11,923; tcl: 3,181; perl: 2,930; makefile: 2,360; sed: 334; yacc: 226; lex: 95; awk: 30; fortran: 24; csh: 23
file content (34 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define ALLOCATE(n) (*gcl_gmp_allocfun)(n)

void *gcl_gmp_alloc(size_t size)
{
   return (void *) ALLOCATE(size);
}

static void *gcl_gmp_realloc(void *oldmem, size_t oldsize, size_t newsize)
{
  unsigned int *old,*new;
  if (!jmp_gmp) { /* No gc in alloc if jmp_gmp */
    if (MP_SELF(big_gcprotect)) do_gcl_abort();
    MP_SELF(big_gcprotect)=oldmem;
    MP_ALLOCATED(big_gcprotect)=oldsize/MP_LIMB_SIZE;
  }
  new = (void *)ALLOCATE(newsize);
  old = jmp_gmp ? oldmem : MP_SELF(big_gcprotect);
  MP_SELF(big_gcprotect)=0;
  bcopy(old,new,oldsize);
/* SGC contblock pages: Its possible this is on an old page CM 20030827 */
/*   if (inheap(oldmem))  */
/* #ifdef SGC */
/*     insert_maybe_sgc_contblock(oldmem,oldsize); */
/* #else */
/*     insert_contblock(oldmem,oldsize); */
/* #endif */

  return new;
}

static void gcl_gmp_free(void *old, size_t oldsize)
{
}