~ubuntu-branches/ubuntu/lucid/xpdf/lucid

« back to all changes in this revision

Viewing changes to goo/gmem.h

  • Committer: Bazaar Package Importer
  • Author(s): Andy Price
  • Date: 2007-05-17 22:04:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517220433-gzcx2lrvllkbl7mr
Tags: 3.02-1ubuntu1
* Merge from Debian unstable (LP: #113365), remaining changes:
  - Added back 09_xpdfrc_manpage.dpatch (LP #71753)
  - Set Ubuntu maintainer

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#define GMEM_H
11
11
 
12
12
#include <stdio.h>
 
13
#include <aconf.h>
 
14
 
 
15
#if USE_EXCEPTIONS
 
16
 
 
17
class GMemException {
 
18
public:
 
19
  GMemException() {}
 
20
  ~GMemException() {}
 
21
};
 
22
 
 
23
#define GMEM_EXCEP throw(GMemException)
 
24
 
 
25
#else // USE_EXCEPTIONS
 
26
 
 
27
#define GMEM_EXCEP
 
28
 
 
29
#endif // USE_EXCEPTIONS
13
30
 
14
31
#ifdef __cplusplus
15
32
extern "C" {
19
36
 * Same as malloc, but prints error message and exits if malloc()
20
37
 * returns NULL.
21
38
 */
22
 
extern void *gmalloc(int size);
 
39
extern void *gmalloc(int size) GMEM_EXCEP;
23
40
 
24
41
/*
25
42
 * Same as realloc, but prints error message and exits if realloc()
26
43
 * returns NULL.  If <p> is NULL, calls malloc instead of realloc().
27
44
 */
28
 
extern void *grealloc(void *p, int size);
 
45
extern void *grealloc(void *p, int size) GMEM_EXCEP;
29
46
 
30
47
/*
31
48
 * These are similar to gmalloc and grealloc, but take an object count
33
50
 * bytes, but there is an additional error check that the total size
34
51
 * doesn't overflow an int.
35
52
 */
36
 
extern void *gmallocn(int nObjs, int objSize);
37
 
extern void *greallocn(void *p, int nObjs, int objSize);
 
53
extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP;
 
54
extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP;
38
55
 
39
56
/*
40
57
 * Same as free, but checks for and ignores NULL pointers.