Initial revision
[swftools.git] / pdf2swf / xpdf / gmem.h
1 /*
2  * gmem.h
3  *
4  * Memory routines with out-of-memory checking.
5  *
6  * Copyright 1996 Derek B. Noonburg
7  */
8
9 #ifndef GMEM_H
10 #define GMEM_H
11
12 #include <stdio.h>
13 #include "../../config.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /*
20  * Same as malloc, but prints error message and exits if malloc()
21  * returns NULL.
22  */
23 extern void *gmalloc(int size);
24
25 /*
26  * Same as realloc, but prints error message and exits if realloc()
27  * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
28  */
29 extern void *grealloc(void *p, int size);
30
31 /*
32  * Same as free, but checks for and ignores NULL pointers.
33  */
34 extern void gfree(void *p);
35
36 #ifdef DEBUG_MEM
37 /*
38  * Report on unfreed memory.
39  */
40 extern void gMemReport(FILE *f);
41 #else
42 #define gMemReport(f)
43 #endif
44
45 /*
46  * Allocate memory and copy a string into it.
47  */
48 extern char *copyString(char *s);
49
50 #ifdef __cplusplus
51 }
52 #endif
53
54 #endif