ESScript
Revision_4488
Main Page
Namespaces
Classes
Files
File List
File Members
esysUtils
src
esys_malloc.h
Go to the documentation of this file.
1
2
/*****************************************************************************
3
*
4
* Copyright (c) 2003-2013 by University of Queensland
5
* http://www.uq.edu.au
6
*
7
* Primary Business: Queensland, Australia
8
* Licensed under the Open Software License version 3.0
9
* http://www.opensource.org/licenses/osl-3.0.php
10
*
11
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12
* Development since 2012 by School of Earth Sciences
13
*
14
*****************************************************************************/
15
16
21
//
22
// @(#) esys_malloc.h
23
//
24
25
#ifndef esys_malloc_h
26
#define esys_malloc_h
27
28
#ifdef _WIN32
29
30
# include <python.h>
31
32
# define ESYS_MALLOC PyMem_Malloc
33
# define ESYS_FREE PyMem_Free
34
# define ESYS_REALLOC PyMem_Realloc
35
36
#else
37
38
# include <stdlib.h>
39
40
# define ESYS_MALLOC ::malloc
41
# define ESYS_FREE ::free
42
# define ESYS_REALLOC ::realloc
43
44
#endif
45
46
namespace
esysUtils
47
{
48
49
inline
50
void
*
malloc
(
size_t
len)
51
{
52
return
ESYS_MALLOC
(len);
53
}
54
55
inline
56
void
free
(
void
*ptr)
57
{
58
ESYS_FREE
(ptr);
59
return
;
60
}
61
62
inline
63
void
*
realloc
(
void
*ptr,
size_t
len)
64
{
65
return
ESYS_REALLOC
(ptr,len);
66
}
67
}
68
69
#undef ESYS_MALLOC
70
#undef ESYS_FREE
71
#undef ESYS_REALLOC
72
73
#endif
Generated on Fri Jun 28 2013 11:10:52 for ESScript by
1.8.1.2