summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/goo/gmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/goo/gmem.h')
-rw-r--r--Build/source/libs/xpdf/goo/gmem.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/Build/source/libs/xpdf/goo/gmem.h b/Build/source/libs/xpdf/goo/gmem.h
index e74d1822318..da34736f216 100644
--- a/Build/source/libs/xpdf/goo/gmem.h
+++ b/Build/source/libs/xpdf/goo/gmem.h
@@ -10,6 +10,23 @@
#define GMEM_H
#include <stdio.h>
+#include <aconf.h>
+
+#if USE_EXCEPTIONS
+
+class GMemException {
+public:
+ GMemException() {}
+ ~GMemException() {}
+};
+
+#define GMEM_EXCEP throw(GMemException)
+
+#else // USE_EXCEPTIONS
+
+#define GMEM_EXCEP
+
+#endif // USE_EXCEPTIONS
#ifdef __cplusplus
extern "C" {
@@ -19,13 +36,13 @@ extern "C" {
* Same as malloc, but prints error message and exits if malloc()
* returns NULL.
*/
-extern void *gmalloc(int size);
+extern void *gmalloc(int size) GMEM_EXCEP;
/*
* Same as realloc, but prints error message and exits if realloc()
* returns NULL. If <p> is NULL, calls malloc instead of realloc().
*/
-extern void *grealloc(void *p, int size);
+extern void *grealloc(void *p, int size) GMEM_EXCEP;
/*
* These are similar to gmalloc and grealloc, but take an object count
@@ -33,8 +50,8 @@ extern void *grealloc(void *p, int size);
* bytes, but there is an additional error check that the total size
* doesn't overflow an int.
*/
-extern void *gmallocn(int nObjs, int objSize);
-extern void *greallocn(void *p, int nObjs, int objSize);
+extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP;
+extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP;
/*
* Same as free, but checks for and ignores NULL pointers.