xref: /plan9/sys/src/cmd/gs/src/malloc_.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1989, 1992, 1996, 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: malloc_.h,v 1.5 2002/06/16 05:03:12 lpd Exp $ */
18 /* Generic substitute for Unix malloc.h */
19 
20 #ifndef malloc__INCLUDED
21 #  define malloc__INCLUDED
22 
23 /* We must include std.h before any file that includes sys/types.h. */
24 #include "std.h"
25 
26 #ifdef __TURBOC__
27 #  include <alloc.h>
28 #else
29 #  if defined(BSD4_2) || defined(apollo) || defined(vax) || defined(sequent) || defined(UTEK)
30 #    if defined(_POSIX_SOURCE) || (defined(__STDC__) && (!defined(sun) || defined(__svr4__)))	/* >>> */
31 #      include <stdlib.h>
32 #    else			/* Ancient breakage */
33 extern char *malloc();
34 extern void free();
35 
36 #    endif
37 #  else
38 #    if defined(_HPUX_SOURCE) || defined(__CONVEX__) || defined(__convex__) || defined(__OSF__) || defined(__386BSD__) || defined(_POSIX_SOURCE) || defined(__STDC__) || defined(VMS)
39 #      include <stdlib.h>
40 #    else
41 #      include <malloc.h>
42 #    endif			/* !_HPUX_SOURCE, ... */
43 #  endif			/* !BSD4_2, ... */
44 #endif /* !__TURBOC__ */
45 
46 /* (At least some versions of) Linux don't have a working realloc.... */
47 #ifdef linux
48 #  define malloc__need_realloc
49 void *gs_realloc(void *, size_t, size_t);
50 
51 #else
52 #  define gs_realloc(ptr, old_size, new_size) realloc(ptr, new_size)
53 #endif
54 
55 #endif /* malloc__INCLUDED */
56