1 /* Copyright (C) 2001-2012 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, 8 modified or distributed except as expressly authorized under the terms 9 of the license contained in the file LICENSE in this distribution. 10 11 Refer to licensing information at http://www.artifex.com or contact 12 Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13 CA 94903, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 /* Generic substitute for Unix malloc.h */ 18 19 #ifndef malloc__INCLUDED 20 # define malloc__INCLUDED 21 22 /* We must include std.h before any file that includes sys/types.h. */ 23 #include "std.h" 24 25 /* This is a good place to #define MEMENTO, if you're using it. */ 26 27 #include "memento.h" 28 29 #ifdef __TURBOC__ 30 # include <alloc.h> 31 #else 32 # if defined(BSD4_2) || defined(apollo) || defined(vax) || defined(sequent) || defined(UTEK) 33 # if defined(_POSIX_SOURCE) || (defined(__STDC__) && (!defined(sun) || defined(__svr4__))) /* >>> */ 34 # include <stdlib.h> 35 # else /* Ancient breakage */ 36 extern char *malloc(); 37 extern void free(); 38 39 # endif 40 # else 41 # if defined(_HPUX_SOURCE) || defined(__CONVEX__) || defined(__convex__) || defined(__OSF__) || defined(__386BSD__) || defined(_POSIX_SOURCE) || defined(__STDC__) || defined(VMS) 42 # include <stdlib.h> 43 # else 44 # include <malloc.h> 45 # endif /* !_HPUX_SOURCE, ... */ 46 # endif /* !BSD4_2, ... */ 47 #endif /* !__TURBOC__ */ 48 49 /* (At least some versions of) Linux don't have a working realloc.... */ 50 #ifdef linux 51 # define malloc__need_realloc 52 void *gs_realloc(void *, size_t, size_t); 53 54 #else 55 # define gs_realloc(ptr, old_size, new_size) realloc(ptr, new_size) 56 #endif 57 58 #endif /* malloc__INCLUDED */ 59