spielwiese
Last change
on this file since 4b73d0 was
4b73d0,
checked in by Hans Schoenemann <hannes@…>, 6 years ago
|
fix: includes for malloc_size/malloc_usable_size
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /******************************************************************* |
---|
2 | * File: omMallocSystem.h |
---|
3 | * Purpose: declaration of macros for malloc to be used from the system |
---|
4 | * Author: obachman (Olaf Bachmann) |
---|
5 | * Created: 11/99 |
---|
6 | *******************************************************************/ |
---|
7 | #ifndef OM_MALLOC_SYSTEM_H |
---|
8 | #define OM_MALLOC_SYSTEM_H |
---|
9 | |
---|
10 | /* this is the minimal set of OM_MALLOC_* macros which must be defined */ |
---|
11 | #define OM_MALLOC_MALLOC malloc |
---|
12 | #define OM_MALLOC_REALLOC realloc |
---|
13 | #define OM_MALLOC_FREE free |
---|
14 | #define OM_MALLOC_VALLOC valloc |
---|
15 | #define OM_MALLOC_VFREE(addr, size) OM_MALLOC_FREE(addr) |
---|
16 | #ifdef HAVE_MALLOC_SIZE |
---|
17 | /* the following will work under Mac OS X */ |
---|
18 | #include <malloc/malloc.h> |
---|
19 | #define OM_MALLOC_SIZEOF_ADDR(addr) (malloc_size(addr)) |
---|
20 | #elif (defined(HAVE_MALLOC_USABLE_SIZE)) |
---|
21 | /* and this will work under Linux */ |
---|
22 | #include <malloc.h> |
---|
23 | #define OM_MALLOC_SIZEOF_ADDR(addr) (malloc_usable_size(addr)) |
---|
24 | #else |
---|
25 | static inline size_t OM_MALLOC_SIZEOF_ADDR(void *d) { long*dd=(long*)d; return *(dd-1); } |
---|
26 | #endif |
---|
27 | |
---|
28 | #endif /* OM_MALLOC_SYSTEM_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.