--- mstools/h/malloc.h 2018/08/09 18:20:01 1.1.1.1 +++ mstools/h/malloc.h 2018/08/09 18:21:11 1.1.1.3 @@ -1,7 +1,7 @@ /*** *malloc.h - declarations and definitions for memory allocation functions * -* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved. +* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved. * *Purpose: * Contains the function declarations for memory allocation functions; @@ -17,23 +17,36 @@ extern "C" { #endif -#if (_MSC_VER <= 600) -#define __cdecl _cdecl -#endif - -#define _HEAPEMPTY (-1) -#define _HEAPOK (-2) -#define _HEAPBADBEGIN (-3) -#define _HEAPBADNODE (-4) -#define _HEAPEND (-5) -#define _HEAPBADPTR (-6) -#define _FREEENTRY 0 -#define _USEDENTRY 1 +/* + * Conditional macro definition for function calling type and variable type + * qualifiers. + */ +#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) ) + +/* + * Definitions for MS C8-32 (386/486) compiler + */ +#define _CRTAPI1 __cdecl +#define _CRTAPI2 __cdecl + +#elif ( _MSC_VER == 600 ) + +/* + * Definitions for old MS C6-386 compiler + */ +#define _CRTAPI1 _cdecl +#define _CRTAPI2 _cdecl +#define _M_IX86 300 + +#else + +/* + * Other compilers (e.g., MIPS) + */ +#define _CRTAPI1 +#define _CRTAPI2 -/* Define _HEAP_MAXREQ to be equal to (unsigned)( -sizeof(_heap_seg_desc) - * - 2*sizeof(int) ) */ - -#define _HEAP_MAXREQ 0xFFFFFFD8 +#endif #ifndef _SIZE_T_DEFINED @@ -42,41 +55,27 @@ typedef unsigned int size_t; #endif -#ifndef _HEAPINFO_DEFINED -typedef struct _heapinfo { - int * _pentry; - size_t _size; - int _useflag; - } _HEAPINFO; -#define _HEAPINFO_DEFINED -#endif - - -/* external variable declarations */ - -extern unsigned int _amblksiz; - - /* function prototypes */ - -void * _alloca(size_t); -void * calloc(size_t, size_t); -void * _expand(void *, size_t); -void free(void *); -int _heapadd(void *, size_t); -int _heapchk(void); -int _heapmin(void); -int _heapset(unsigned int); -int _heapwalk(_HEAPINFO *); -void * malloc(size_t); -size_t _msize(void *); -void * realloc(void *, size_t); +void * _CRTAPI1 calloc(size_t, size_t); +void _CRTAPI1 free(void *); +void * _CRTAPI1 malloc(size_t); +void * _CRTAPI1 realloc(void *, size_t); + +#ifndef _POSIX_ +void * _CRTAPI1 _alloca(size_t); +void * _CRTAPI1 _expand(void *, size_t); +size_t _CRTAPI1 _msize(void *); +#endif /* !_POSIX_ */ #if !__STDC__ /* Non-ANSI names for compatibility */ #define alloca _alloca #endif /* __STDC__*/ +#ifdef MIPS +#pragma intrinsic(_alloca); +#endif + #ifdef __cplusplus } #endif