source: git/factory/initgmp.cc @ c74d6a

spielwiese
Last change on this file since c74d6a was 650f2d8, checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
renamed assert.h -> cf_assert.h in factory
  • Property mode set to 100644
File size: 1.0 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#include <config.h>
5
6#include "cf_assert.h"
7
8#include "cf_gmp.h"
9
10#include "cf_defs.h"
11#ifdef USE_MEMUTIL
12#ifdef USE_OLD_MEMMAN
13#include "memutil.h"
14#else
15#include "memman.h"
16#endif
17#endif
18
19#ifdef USE_MEMUTIL
20#ifndef USE_OLD_MEMMAN
21#ifdef MDEBUG
22void * mgAllocBlock( size_t t)
23{
24  return mmDBAllocBlock(t,"gmp",0);
25}
26void mgFreeBlock( void* a, size_t t)
27{
28  mmDBFreeBlock(a,t,"gmp",0);
29}
30void * mgReallocBlock( void* a, size_t t1, size_t t2)
31{
32  return mmDBReallocBlock(a,t1,t2,"gmp",0);
33}
34#endif
35#endif
36#endif
37
38int initializeGMP()
39{
40#ifdef USE_MEMUTIL
41  static int initialized = 0;
42
43  if ( ! initialized )
44  {
45    initialized = 1;
46#ifdef USE_OLD_MEMMAN
47    mp_set_memory_functions( getBlock, reallocBlock, freeBlock );
48#else
49#ifdef MDEBUG
50    mp_set_memory_functions( mgAllocBlock, mgReallocBlock, mgFreeBlock );
51#else
52    // do not initialize this within Singular:
53    mp_set_memory_functions( mmAllocBlock, mmReallocBlock, mmFreeBlock );
54#endif
55#endif
56  }
57#endif
58  return 1;
59}
Note: See TracBrowser for help on using the repository browser.