fieker-DuValspielwiese
Last change
on this file since db143c was
25ea9a7,
checked in by Hans Schoenemann <hannes@…>, 6 years ago
|
port: use stdlib.h instead of malloc.h
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[e70e45] | 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) |
---|
[e51781] | 16 | #ifdef HAVE_MALLOC_SIZE |
---|
[9cf75aa] | 17 | /* the following will work under Mac OS X */ |
---|
[4b73d0] | 18 | #include <malloc/malloc.h> |
---|
[9cf75aa] | 19 | #define OM_MALLOC_SIZEOF_ADDR(addr) (malloc_size(addr)) |
---|
[e51781] | 20 | #elif (defined(HAVE_MALLOC_USABLE_SIZE)) |
---|
| 21 | /* and this will work under Linux */ |
---|
[25ea9a7] | 22 | #include <stdlib.h> |
---|
[e51781] | 23 | #define OM_MALLOC_SIZEOF_ADDR(addr) (malloc_usable_size(addr)) |
---|
| 24 | #else |
---|
[c2f5726] | 25 | static inline size_t OM_MALLOC_SIZEOF_ADDR(void *d) { long*dd=(long*)d; return *(dd-1); } |
---|
[e51781] | 26 | #endif |
---|
[e70e45] | 27 | |
---|
| 28 | #endif /* OM_MALLOC_SYSTEM_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.