--- mstools/h/malloc.h 2018/08/09 18:20:32 1.1.1.2 +++ 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,12 +17,38 @@ extern "C" { #endif -#ifndef MIPS -#if (_MSC_VER <= 600) -#define __cdecl _cdecl -#endif +/* + * 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 + #endif + #ifndef _SIZE_T_DEFINED typedef unsigned int size_t; #define _SIZE_T_DEFINED @@ -30,15 +56,15 @@ typedef unsigned int size_t; /* function prototypes */ -void * calloc(size_t, size_t); -void free(void *); -void * malloc(size_t); -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 * _alloca(size_t); -void * _expand(void *, size_t); -size_t _msize(void *); +void * _CRTAPI1 _alloca(size_t); +void * _CRTAPI1 _expand(void *, size_t); +size_t _CRTAPI1 _msize(void *); #endif /* !_POSIX_ */ #if !__STDC__ @@ -46,6 +72,10 @@ size_t _msize(void *); #define alloca _alloca #endif /* __STDC__*/ +#ifdef MIPS +#pragma intrinsic(_alloca); +#endif + #ifdef __cplusplus } #endif