source: git/factory/initgmp.cc @ a07e45

spielwiese
Last change on this file since a07e45 was a07e45, checked in by Hans Schönemann <hannes@…>, 14 years ago
*hannes: no mp_set_memory_functions for Singular git-svn-id: file:///usr/local/Singular/svn/trunk@12030 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[a07e45]2/* $Id: initgmp.cc,v 1.5 2009-07-28 14:51:07 Singular Exp $ */
[2dd068]3
[9d7aaa]4#include <config.h>
5
[2dd068]6#include "cf_gmp.h"
7
8#include "assert.h"
[a9974a]9
[2dd068]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{
[3cd130]40#ifdef USE_MEMUTIL
[2dd068]41  static int initialized = 0;
42
[3cd130]43  if ( ! initialized )
44  {
[2dd068]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
[a07e45]52#ifndef SINGULAR
53    // do not initialize this within Singular:
[2dd068]54    mp_set_memory_functions( mmAllocBlock, mmReallocBlock, mmFreeBlock );
55#endif
[a07e45]56#endif
[2dd068]57#endif
58  }
[3cd130]59#endif
[2dd068]60  return 1;
61}
Note: See TracBrowser for help on using the repository browser.