/[escript]/trunk/esysUtils/src/esys_malloc.h
ViewVC logotype

Annotation of /trunk/esysUtils/src/esys_malloc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 1149 byte(s)
Copyright updated in all files

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

  ViewVC Help
Powered by ViewVC 1.1.26