/[escript]/branches/windows_from_1456_trunk_1580_merged_in/esysUtils/src/esys_malloc.h
ViewVC logotype

Annotation of /branches/windows_from_1456_trunk_1580_merged_in/esysUtils/src/esys_malloc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1612 - (hide annotations)
Mon Jun 16 14:01:00 2008 UTC (12 years, 3 months ago) by phornby
File MIME type: text/plain
File size: 1184 byte(s)
Fix a silly scoping error that made esysUtils::malloc and co.
become recursive. (OOPS). This fixes the DumpAndLoad unit test failures.


1 phornby 1587
2     /* $Id$ */
3    
4     /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16     /**
17     \file esys_malloc.h
18     \ingroup Other
19     */
20     //
21     // @(#) esys_malloc.h
22     //
23    
24     #ifndef esys_malloc_h
25     #define esys_malloc_h
26    
27     #ifdef _WIN32
28    
29     # include <python.h>
30 phornby 1612
31 phornby 1587 # define ESYS_MALLOC PyMem_Malloc
32     # define ESYS_FREE PyMem_Free
33     # define ESYS_REALLOC PyMem_Realloc
34    
35     #else
36 phornby 1612
37 phornby 1587 # include <malloc.h>
38    
39 phornby 1612 # define ESYS_MALLOC ::malloc
40     # define ESYS_FREE ::free
41     # define ESYS_REALLOC ::realloc
42    
43 phornby 1587 #endif
44    
45     namespace esysUtils
46     {
47    
48     inline
49     void *malloc(size_t len)
50     {
51     return ESYS_MALLOC(len);
52     }
53    
54     inline
55     void free(void *ptr)
56     {
57     ESYS_FREE(ptr);
58     return;
59     }
60    
61     inline
62     void *realloc(void *ptr, size_t len)
63     {
64     return ESYS_REALLOC(ptr,len);
65     }
66     }
67    
68     #undef ESYS_MALLOC
69     #undef ESYS_FREE
70     #undef ESYS_REALLOC
71    
72     #endif

  ViewVC Help
Powered by ViewVC 1.1.26