Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /****************************************************************************
  2. *
  3. *                            Open Watcom Project
  4. *
  5. *    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. *
  7. *  ========================================================================
  8. *
  9. *    This file contains Original Code and/or Modifications of Original
  10. *    Code as defined in and that are subject to the Sybase Open Watcom
  11. *    Public License version 1.0 (the 'License'). You may not use this file
  12. *    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. *    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. *    provided with the Original Code and Modifications, and is also
  15. *    available at www.sybase.com/developer/opensource.
  16. *
  17. *    The Original Code and all software distributed under the License are
  18. *    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. *    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. *    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. *    NON-INFRINGEMENT. Please see the License for the specific language
  23. *    governing rights and limitations under the License.
  24. *
  25. *  ========================================================================
  26. *
  27. * Description:  These are macros that define the 'real' functions that
  28. *               the library memory allocators use.
  29. *
  30. ****************************************************************************/
  31.  
  32.  
  33. #ifndef _LIBALLOC_H_INCLUDED
  34. #define _LIBALLOC_H_INCLUDED
  35. #include "variety.h"
  36. #include <malloc.h>
  37.  
  38. #ifdef __NETWARE__
  39.  
  40.     /*
  41.     //  NetWare uses Alloc and Free because the heap will not have
  42.     //  been initialised at _Prelude time...
  43.     */
  44.  
  45.     #define lib_malloc( x )         _NW_malloc( x )
  46.     #define lib_free( x )           _NW_free( x )
  47.     #if defined (_NETWARE_CLIB)
  48.         #define lib_realloc( x, y, z)  _NW_realloc( x, y, z )
  49.     #else
  50.         #define lib_realloc( x, y)  _NW_realloc( x, y)
  51.     #endif
  52.     #define lib_calloc( x, y )      _NW_calloc( x, y )
  53.  
  54.     extern void *_NW_calloc( size_t __n,size_t __size );
  55.     extern void *_NW_malloc( size_t );
  56.     #if defined (_NETWARE_CLIB)
  57.     extern void *_NW_realloc( void *ptr,size_t size,size_t old);
  58.     #else
  59.     extern void *_NW_realloc( void *ptr,size_t size);
  60.     #endif
  61.     extern void _NW_free( void *ptr );
  62. #else
  63.     #define lib_malloc( x ) malloc( x )
  64.     #define lib_free( x ) free( x )
  65.     #define lib_realloc( x, y ) realloc( x, y )
  66.  
  67.     #define lib_nmalloc( x ) _nmalloc( x )
  68.     #define lib_nfree( x ) _nfree( x )
  69.     #define lib_nrealloc( x, y ) _nrealloc( x, y )
  70.  
  71.     #define lib_fmalloc( x ) _fmalloc( x )
  72.     #define lib_ffree( x ) _ffree( x )
  73.     #define lib_frealloc( x, y ) _frealloc( x, y )
  74.  
  75.     #define lib_calloc( x, y ) calloc( x, y )
  76. #endif
  77.  
  78. // these are used by the C++ library
  79. // they are real routines so that the C++ library
  80. // remains platform independent.
  81. #ifdef __cplusplus
  82. extern "C" {
  83. #endif
  84. _WCRTLINK extern void _plib_free( void *ptr );
  85. _WCRTLINK extern void *_plib_malloc( size_t size );
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #endif
  91.