File: omMallocSystem.h

package info (click to toggle)
singular 1%3A4.4.1-p5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,496 kB
  • sloc: cpp: 317,877; ansic: 42,289; perl: 5,855; sh: 5,178; lisp: 4,241; python: 2,101; makefile: 1,893; yacc: 1,651; pascal: 1,411; lex: 1,367; tcl: 1,024; xml: 182
file content (32 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*******************************************************************
 *  File:    omMallocSystem.h
 *  Purpose: declaration of macros for malloc to be used from the system
 *  Author:  obachman (Olaf Bachmann)
 *  Created: 11/99
 *******************************************************************/
#ifndef OM_MALLOC_SYSTEM_H
#define OM_MALLOC_SYSTEM_H

/* this is the minimal set of OM_MALLOC_* macros which must be defined */
#define OM_MALLOC_MALLOC   malloc
#define OM_MALLOC_REALLOC  realloc
#define OM_MALLOC_FREE     free
#define OM_MALLOC_VALLOC   valloc
#define OM_MALLOC_VFREE(addr, size) OM_MALLOC_FREE(addr)
#ifdef HAVE_MALLOC_SIZE
/* the following will work under Mac OS X */
  #ifdef HAVE_MALLOC_H
  #include <malloc.h>
  #elif defined(HAVE_MALLOC_MALLOC_H)
  #include <malloc/malloc.h>
  #endif
  #define OM_MALLOC_SIZEOF_ADDR(addr)  (malloc_size(addr))
#elif (defined(HAVE_MALLOC_USABLE_SIZE))
/* and this will work under Linux */
#include <stdlib.h>
#define OM_MALLOC_SIZEOF_ADDR(addr) (malloc_usable_size(addr))
#else
static inline size_t OM_MALLOC_SIZEOF_ADDR(void *d) { long*dd=(long*)d; return *(dd-1); }
#endif

#endif /* OM_MALLOC_SYSTEM_H */