1 /********************************************************************
2  * $Author: jgoerzen $
3  * $Revision: 1.3 $
4  * $Date: 2002/01/28 03:38:58 $
5  * $Source: /home/jgoerzen/tmp/gopher-umn/gopher/head/object/Malloc.h,v $
6  * $Status: $
7  *
8  * Paul Lindner, University of Minnesota CIS.
9  *
10  * Copyright 1991, 1992 by the Regents of the University of Minnesota
11  * see the file "Copyright" in the distribution for conditions of use.
12  *********************************************************************
13  * MODULE: Malloc.h
14  * Portable method of getting malloc definitions
15  *********************************************************************
16  * Revision History:
17  * $Log: Malloc.h,v $
18  * Revision 1.3  2002/01/28 03:38:58  jgoerzen
19  * Patches for FreeBSD:
20  *  * Test in configure for stdlib.h
21  *  * Include stdlib.h if it's available in Malloc.h
22  *  * Don't include malloc.h if it's missing in Malloc.h
23  *  * Don't include strcasestr if it's present in util.c and util.h
24  *
25  * Revision 1.2  2000/08/23 00:03:59  jgoerzen
26  * Updates
27  *
28  * Revision 1.1.1.1  2000/08/19 00:28:56  jgoerzen
29  * Import from UMN Gopher 2.3.1 after GPLization
30  *
31  * Revision 3.9  1996/01/04  18:25:38  lindner
32  * Updates for autoconf
33  *
34  * Revision 3.8  1995/06/30  20:30:01  lindner
35  * NewMEM define
36  *
37  * Revision 3.7  1994/06/29  06:37:55  lindner
38  * ...
39  *
40  * Revision 3.6  1994/06/29  05:44:17  lindner
41  * Make sure to only include malloc.h once
42  *
43  * Revision 3.5  1994/05/24  05:42:17  lindner
44  * Fix for old field version of DECC
45  *
46  * Revision 3.4  1994/05/19  14:25:24  lindner
47  * faster VMS VAXC malloc
48  *
49  * Revision 3.3  1993/10/19  20:46:35  lindner
50  * use stdio.h in Malloc.h to get NULL if necessary
51  *
52  * Revision 3.2  1993/10/11  17:23:32  lindner
53  * Better malloc fix for systems without NULL
54  *
55  * Revision 3.1.1.1  1993/02/11  18:03:03  lindner
56  * Gopher+1.2beta release
57  *
58  * Revision 1.1  1992/12/10  23:27:52  lindner
59  * gopher 1.1 release
60  *
61  *
62  *********************************************************************/
63 
64 #ifndef G_MALLOC_H
65 #define G_MALLOC_H
66 
67 /*
68  * Just enough to get us memory allocation and NULL
69  *
70  * Ick, portable code is ugly!
71  */
72 
73 #include "Stdlib.h"
74 #ifdef HAVE_MALLOC_H
75 #include <stdlib.h>
76 #endif
77 
78 #ifdef HAVE_STDLIB_H
79 #include <stdlib.h>
80 #endif
81 
82 /* Usually can get NULL from stdio.h */
83 #ifndef NULL
84 #include <stdio.h>
85 #endif
86 
87 /* Punt! */
88 #ifndef NULL
89 #define NULL ((void*) 0)
90 #endif
91 
92 
93 #ifdef HAVE_MALLOC_H
94 #  include <stdlib.h>
95 #endif
96 
97 /* memory management for VAXC */
98 
99 #if defined(VMS) && defined(VAXC) && !defined(__DECC)
100 #  include <stdlib.h>
101 #  define malloc  VAXC$MALLOC_OPT
102 #  define calloc  VAXC$CALLOC_OPT
103 #  define free    VAXC$FREE_OPT
104 #  define cfree   VAXC$CFREE_OPT
105 #  define realloc VAXC$REALLOC_OPT
106 #endif /* VMS and VAXC */
107 
108 #define NewMEM(a) ((a*)malloc(sizeof(a)))
109 
110 
111 #endif /* G_MALLOC_H */
112 
113