My Project  debian-1:4.1.2-p1+ds-2
omMallocSystem.h
Go to the documentation of this file.
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 <stdlib.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 */
static size_t OM_MALLOC_SIZEOF_ADDR(void *d)