[3908] | 1 | /** |
---|
| 2 | * (C) Copyright 2014- ECMWF. |
---|
| 3 | * |
---|
| 4 | * This software is licensed under the terms of the Apache Licence Version 2.0 |
---|
| 5 | * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
---|
| 6 | * |
---|
| 7 | * In applying this licence, ECMWF does not waive the privileges and immunities |
---|
| 8 | * granted to it by virtue of its status as an intergovernmental organisation |
---|
| 9 | * nor does it submit to any jurisdiction. |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #ifndef _INTERCEPT_ALLOC_H_ |
---|
| 13 | #define _INTERCEPT_ALLOC_H_ |
---|
| 14 | |
---|
| 15 | /* intercept_alloc.h */ |
---|
| 16 | |
---|
| 17 | #if defined(INTERCEPT_ALLOC) |
---|
| 18 | |
---|
| 19 | #if defined(RS6K) && defined(__64BIT__) |
---|
| 20 | |
---|
| 21 | #define EC_free __free |
---|
| 22 | #define EC_malloc __malloc |
---|
| 23 | #define EC_calloc __calloc |
---|
| 24 | #define EC_realloc __realloc |
---|
| 25 | #define EC_strdup __strdup |
---|
| 26 | |
---|
| 27 | #elif defined(NECSX) |
---|
| 28 | /* Do nothing */ |
---|
| 29 | #else |
---|
| 30 | /* Illegal to have -DINTERCEPT_ALLOC */ |
---|
| 31 | #undef INTERCEPT_ALLOC |
---|
| 32 | #endif |
---|
| 33 | |
---|
| 34 | #endif |
---|
| 35 | |
---|
| 36 | #if defined(INTERCEPT_ALLOC) |
---|
| 37 | |
---|
| 38 | /* For reference, see also ifsaux/utilities/getcurheap.c */ |
---|
| 39 | |
---|
| 40 | #define THEmalloc EC_malloc |
---|
| 41 | extern void *EC_malloc(long long int size); |
---|
| 42 | #define THEcalloc EC_calloc |
---|
| 43 | extern void *EC_calloc(long long int nelem, long long int elsize); |
---|
| 44 | #define THErealloc EC_realloc |
---|
| 45 | extern void *EC_realloc(void *p, long long int size); |
---|
| 46 | #define THEstrdup EC_strdup |
---|
| 47 | extern char *EC_strdup(const char *s); |
---|
| 48 | #define THEfree EC_free |
---|
| 49 | extern void EC_free(void *p); |
---|
| 50 | |
---|
| 51 | #else /* i.e. !defined(INTERCEPT_ALLOC) */ |
---|
| 52 | |
---|
| 53 | #define THEmalloc malloc |
---|
| 54 | #define THEcalloc calloc |
---|
| 55 | #define THErealloc realloc |
---|
| 56 | #define THEstrdup strdup |
---|
| 57 | #define THEfree free |
---|
| 58 | |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | #endif /* _INTERCEPT_ALLOC_H_ */ |
---|