source: trunk/poppler/mypoppler/goo/gmem.h @ 2

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 15 years ago

First import

File size: 1.2 KB
Line 
1/*
2 * gmem.h
3 *
4 * Memory routines with out-of-memory checking.
5 *
6 * Copyright 1996-2003 Glyph & Cog, LLC
7 */
8
9#ifndef GMEM_H
10#define GMEM_H
11
12#include <stdio.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * Same as malloc, but prints error message and exits if malloc()
20 * returns NULL.
21 */
22extern void *gmalloc(size_t size);
23
24/*
25 * Same as realloc, but prints error message and exits if realloc()
26 * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
27 */
28extern void *grealloc(void *p, size_t size);
29
30/*
31 * These are similar to gmalloc and grealloc, but take an object count
32 * and size.  The result is similar to allocating nObjs * objSize
33 * bytes, but there is an additional error check that the total size
34 * doesn't overflow an int.
35 */
36extern void *gmallocn(int nObjs, int objSize);
37extern void *greallocn(void *p, int nObjs, int objSize);
38
39/*
40 * Same as free, but checks for and ignores NULL pointers.
41 */
42extern void gfree(void *p);
43
44#ifdef DEBUG_MEM
45/*
46 * Report on unfreed memory.
47 */
48extern void gMemReport(FILE *f);
49#else
50#define gMemReport(f)
51#endif
52
53/*
54 * Allocate memory and copy a string into it.
55 */
56extern char *copyString(char *s);
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif
Note: See TracBrowser for help on using the repository browser.