ESYS13
Revision_
|
00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2012 by University of Queensland 00005 * Earth Systems Science Computational Center (ESSCC) 00006 * http://www.uq.edu.au/esscc 00007 * 00008 * Primary Business: Queensland, Australia 00009 * Licensed under the Open Software License version 3.0 00010 * http://www.opensource.org/licenses/osl-3.0.php 00011 * 00012 *******************************************************/ 00013 00014 00019 // 00020 // @(#) esys_malloc.h 00021 // 00022 00023 #ifndef esys_malloc_h 00024 #define esys_malloc_h 00025 00026 #ifdef _WIN32 00027 00028 # include <python.h> 00029 00030 # define ESYS_MALLOC PyMem_Malloc 00031 # define ESYS_FREE PyMem_Free 00032 # define ESYS_REALLOC PyMem_Realloc 00033 00034 #else 00035 00036 # include <stdlib.h> 00037 00038 # define ESYS_MALLOC ::malloc 00039 # define ESYS_FREE ::free 00040 # define ESYS_REALLOC ::realloc 00041 00042 #endif 00043 00044 namespace esysUtils 00045 { 00046 00047 inline 00048 void *malloc(size_t len) 00049 { 00050 return ESYS_MALLOC(len); 00051 } 00052 00053 inline 00054 void free(void *ptr) 00055 { 00056 ESYS_FREE(ptr); 00057 return; 00058 } 00059 00060 inline 00061 void *realloc(void *ptr, size_t len) 00062 { 00063 return ESYS_REALLOC(ptr,len); 00064 } 00065 } 00066 00067 #undef ESYS_MALLOC 00068 #undef ESYS_FREE 00069 #undef ESYS_REALLOC 00070 00071 #endif