home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / INCLUDE / MALLOC.H < prev    next >
Text File  |  1993-09-17  |  4KB  |  111 lines

  1. #pragma info( none )
  2. #ifndef __CHKHDR__
  3.    #pragma info( none )
  4. #endif
  5. #pragma info( restore )
  6.  
  7. #if ( !defined(__malloc_h) && !defined(__stdlib_h) )
  8.    #define __malloc_h
  9.  
  10.    #ifdef __cplusplus
  11.       extern "C" {
  12.    #endif
  13.  
  14.    /********************************************************************/
  15.    /*  <malloc.h> header file                                          */
  16.    /*                                                                  */
  17.    /*  Licensed Materials - Property of IBM                            */
  18.    /*                                                                  */
  19.    /*  IBM C/C++ Tools Version 2.01                                    */
  20.    /*  Copyright (C) International Business Machines Corp., 1991,1993  */
  21.    /*  All rights reserved                                             */
  22.    /*                                                                  */
  23.    /*  US Government Users Restricted Rights -                         */
  24.    /*  Use, duplication, or disclosure restricted                      */
  25.    /*  by GSA ADP Schedule Contract with IBM Corp.                     */
  26.    /*                                                                  */
  27.    /********************************************************************/
  28.  
  29.    #if defined(__EXTENDED__)
  30.  
  31.       #ifndef __size_t
  32.         #define __size_t
  33.         typedef unsigned int size_t;
  34.       #endif
  35.  
  36.       /* Define different memory model versions of memory management       */
  37.       /* routines to the standard names.                                   */
  38.  
  39.       #define _ncalloc( x, y )  calloc( (x), (y) )
  40.       #define _fcalloc( x, y )  calloc( (x), (y) )
  41.       #define _nfree( x )       free( (x) )
  42.       #define _ffree( x )       free( (x) )
  43.       #define _nmalloc( x )     malloc( (x) )
  44.       #define _fmalloc( x )     malloc( (x) )
  45.       #define _nrealloc( x, y ) realloc( (x), (y) )
  46.       #define _frealloc( x, y ) realloc( (x), (y) )
  47.       #define _fheapmin( )      _heapmin( )
  48.       #define _nheapmin( )      _heapmin( )
  49.  
  50.       /* function prototypes */
  51.  
  52.       #ifndef _alloca
  53.          void * _Builtin __alloca( size_t );
  54.          #pragma info( none )
  55.          #define _alloca( x ) __alloca( (x) )
  56.          #define alloca( x ) __alloca( (x) )
  57.          #pragma info( restore )
  58.       #endif
  59.  
  60.       void * _Optlink calloc( size_t, size_t );
  61.       void   _Optlink free( void * );
  62.       void * _Optlink malloc( size_t );
  63.       void * _Optlink realloc( void *, size_t );
  64.       int    _Optlink _heapmin(void);
  65.       size_t _Optlink _msize(void *);
  66.  
  67.       #if (defined(__DEBUG_ALLOC__) && !defined(__TILED__))
  68.          void * _Optlink _debug_calloc( size_t, size_t, const char *, size_t );
  69.          void   _Optlink _debug_free( void *, const char *, size_t );
  70.          void * _Optlink _debug_malloc( size_t, const char *, size_t );
  71.          void * _Optlink _debug_realloc( void *, size_t, const char *, size_t );
  72.          int    _Optlink _debug_heapmin( const char *, size_t );
  73.          void   _Optlink _heap_check( void );
  74.          void   _Optlink _dump_allocated( int );
  75.          #pragma info( none )
  76.          #define calloc( x, y )  _debug_calloc( (x), (y), __FILE__, __LINE__ )
  77.          #define free( x )       _debug_free( (x), __FILE__, __LINE__ )
  78.          #define malloc( x )     _debug_malloc( (x), __FILE__, __LINE__ )
  79.          #define realloc( x, y ) _debug_realloc( (x), (y), __FILE__, __LINE__ )
  80.          #define _heapmin( )     _debug_heapmin( __FILE__, __LINE__ )
  81.          #pragma info( restore )
  82.       #else
  83.          #define _heap_check( )
  84.          #define _dump_allocated( x )
  85.       #endif
  86.  
  87.       #ifdef __TILED__
  88.          void * _Optlink _tcalloc( size_t, size_t );
  89.          void   _Optlink _tfree( void * );
  90.          void * _Optlink _tmalloc( size_t );
  91.          void * _Optlink _trealloc( void *, size_t );
  92.          #pragma map( calloc , "_tcalloc"  )
  93.          #pragma map( free   , "_tfree"    )
  94.          #pragma map( malloc , "_tmalloc"  )
  95.          #pragma map( realloc, "_trealloc" )
  96.       #endif
  97.  
  98.    #endif
  99.  
  100.    #ifdef __cplusplus
  101.       }
  102.    #endif
  103.  
  104. #endif
  105.  
  106. #pragma info( none )
  107. #ifndef __CHKHDR__
  108.    #pragma info( restore )
  109. #endif
  110. #pragma info( restore )
  111.