diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:13:18 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2014-06-06 19:13:18 +0200 |
commit | 2ff9024f1905b71eb4af422e8bd25c2e4e0ed398 (patch) | |
tree | f34e06855f111ddf55ba70f8c1610bdfda3cd800 | |
parent | 15bd5c87ea850423ad21c08b03cb20cd8010b855 (diff) |
Do not merge gMemError()
Poppler doesn't support exceptions, and we already have our own way to
report and handle memory errors
-rw-r--r-- | ALL_DIFF | 157 |
1 files changed, 0 insertions, 157 deletions
@@ -6389,163 +6389,6 @@ diff -uNrp xpdf-3.03/goo/gfile.h xpdf-3.04/goo/gfile.h #else DIR *dir; // the DIR structure from opendir() #ifdef VMS -diff -uNrp xpdf-3.03/goo/gmem.cc xpdf-3.04/goo/gmem.cc ---- xpdf-3.03/goo/gmem.cc 2011-08-15 23:08:53.000000000 +0200 -+++ xpdf-3.04/goo/gmem.cc 2014-05-28 20:50:50.000000000 +0200 -@@ -56,24 +57,14 @@ void *gmalloc(int size) GMEM_EXCEP { - unsigned long *trl, *p; - - if (size < 0) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Invalid memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Invalid memory allocation size"); - } - if (size == 0) { - return NULL; - } - size1 = gMemDataSize(size); - if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Out of memory\n"); -- exit(1); --#endif -+ gMemError("Out of memory"); - } - hdr = (GMemHdr *)mem; - data = (void *)(mem + gMemHdrSize); -@@ -100,23 +94,13 @@ void *gmalloc(int size) GMEM_EXCEP { - void *p; - - if (size < 0) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Invalid memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Invalid memory allocation size"); - } - if (size == 0) { - return NULL; - } - if (!(p = malloc(size))) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Out of memory\n"); -- exit(1); --#endif -+ gMemError("Out of memory"); - } - return p; - #endif -@@ -129,12 +113,7 @@ void *grealloc(void *p, int size) GMEM_E - int oldSize; - - if (size < 0) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Invalid memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Invalid memory allocation size"); - } - if (size == 0) { - if (p) { -@@ -156,12 +135,7 @@ void *grealloc(void *p, int size) GMEM_E - void *q; - - if (size < 0) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Invalid memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Invalid memory allocation size"); - } - if (size == 0) { - if (p) { -@@ -175,12 +149,7 @@ void *grealloc(void *p, int size) GMEM_E - q = malloc(size); - } - if (!q) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Out of memory\n"); -- exit(1); --#endif -+ gMemError("Out of memory"); - } - return q; - #endif -@@ -194,12 +163,7 @@ void *gmallocn(int nObjs, int objSize) G - } - n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Bogus memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Bogus memory allocation size"); - } - return gmalloc(n); - } -@@ -215,12 +179,7 @@ void *greallocn(void *p, int nObjs, int - } - n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { --#if USE_EXCEPTIONS -- throw GMemException(); --#else -- fprintf(stderr, "Bogus memory allocation size\n"); -- exit(1); --#endif -+ gMemError("Bogus memory allocation size"); - } - return grealloc(p, n); - } -@@ -269,11 +228,21 @@ void gfree(void *p) { - #endif - } - -+void gMemError(const char *msg) GMEM_EXCEP { -+#if USE_EXCEPTIONS -+ throw GMemException(); -+#else -+ fprintf(stderr, "%s\n", msg); -+ exit(1); -+#endif -+} -+ - #ifdef DEBUG_MEM - void gMemReport(FILE *f) { - GMemHdr *p; -diff -uNrp xpdf-3.03/goo/gmem.h xpdf-3.04/goo/gmem.h ---- xpdf-3.03/goo/gmem.h 2011-08-15 23:08:53.000000000 +0200 -+++ xpdf-3.04/goo/gmem.h 2014-05-28 20:50:50.000000000 +0200 -@@ -58,6 +58,11 @@ extern void *greallocn(void *p, int nObj - */ - extern void gfree(void *p); - -+/* -+ * Report a memory error. -+ */ -+extern void gMemError(const char *msg) GMEM_EXCEP; -+ - #ifdef DEBUG_MEM - /* - * Report on unfreed memory. diff -uNrp xpdf-3.03/goo/GMutex.h xpdf-3.04/goo/GMutex.h --- xpdf-3.03/goo/GMutex.h 2011-08-15 23:08:53.000000000 +0200 +++ xpdf-3.04/goo/GMutex.h 2014-05-28 20:50:50.000000000 +0200 |