[poppler] 2 commits - CMakeLists.txt config.h.cmake configure.ac .gitignore goo/gmem.cc goo/gmem.h poppler/poppler-config.h.cmake poppler/poppler-config.h.in

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jul 19 08:32:50 PDT 2010


 .gitignore                     |    7 +++++
 CMakeLists.txt                 |    1 
 config.h.cmake                 |    3 --
 configure.ac                   |    4 --
 goo/gmem.cc                    |   56 +++++++++++------------------------------
 goo/gmem.h                     |   38 ++++++++-------------------
 poppler/poppler-config.h.cmake |    5 ---
 poppler/poppler-config.h.in    |    5 ---
 8 files changed, 34 insertions(+), 85 deletions(-)

New commits:
commit 49ffb46db3118db874d2d9830bb034762d625c61
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 19 16:31:54 2010 +0100

    Remove exception support
    
    We don't use it and don't even support it properly

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a11d96c..916a780 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,6 @@ option(ENABLE_LIBOPENJPEG "Use libopenjpeg for JPX streams." ON)
 option(ENABLE_LCMS "Use liblcms for color management." ON)
 option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
 option(ENABLE_ZLIB "Build with zlib (not totally safe)." OFF)
-option(USE_EXCEPTIONS "Throw exceptions to deal with not enough memory and similar problems." OFF)
 option(USE_FIXEDPOINT "Use fixed point arithmetic in the Splash backend" OFF)
 option(USE_FLOAT "Use single precision arithmetic in the Splash backend" OFF)
 if(WIN32)
diff --git a/config.h.cmake b/config.h.cmake
index 0879aeb..123288a 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -171,9 +171,6 @@
 /* Defines if use cms */
 #cmakedefine USE_CMS 1
 
-/* Throw exceptions to deal with not enough memory and similar problems */
-#cmakedefine USE_EXCEPTIONS 1
-
 /* Use fixed point arithmetic in the Splash backend */
 #cmakedefine USE_FIXEDPOINT 1
 
diff --git a/configure.ac b/configure.ac
index 060028f..a1a5d02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,10 +108,6 @@ dnl ##### Checks for header files.
 AC_PATH_XTRA
 AC_HEADER_DIRENT
 
-AC_ARG_ENABLE(exceptions,
-	      [  --enable-exceptions     use C++ exceptions],
-	      AC_DEFINE([USE_EXCEPTIONS], [1], [Throw exceptions to deal with not enough memory and similar problems]))
-
 dnl ##### Switch over to C++.  This will make the checks below a little
 dnl ##### bit stricter (requiring function prototypes in include files).
 dnl ##### (99% of xpdf is written in C++.)
diff --git a/goo/gmem.cc b/goo/gmem.cc
index af3e19e..ff0703b 100644
--- a/goo/gmem.cc
+++ b/goo/gmem.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2007-2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2010 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Jonathan Kew <jonathan_kew at sil.org>
 //
 // To see a description of the changes please see the Changelog file that
@@ -63,7 +63,7 @@ static int gMemInUse = 0;
 
 #endif /* DEBUG_MEM */
 
-inline static void *gmalloc(size_t size, bool checkoverflow) GMEM_EXCEP {
+inline static void *gmalloc(size_t size, bool checkoverflow) {
 #ifdef DEBUG_MEM
   int size1;
   char *mem;
@@ -76,13 +76,9 @@ inline static void *gmalloc(size_t size, bool checkoverflow) GMEM_EXCEP {
   }
   size1 = gMemDataSize(size);
   if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
-#if USE_EXCEPTIONS
-    throw GMemException();
-#else
     fprintf(stderr, "Out of memory\n");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   hdr = (GMemHdr *)mem;
   data = (void *)(mem + gMemHdrSize);
@@ -112,27 +108,23 @@ inline static void *gmalloc(size_t size, bool checkoverflow) GMEM_EXCEP {
     return NULL;
   }
   if (!(p = malloc(size))) {
-#if USE_EXCEPTIONS
-    throw GMemException();
-#else
     fprintf(stderr, "Out of memory\n");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   return p;
 #endif
 }
 
-void *gmalloc(size_t size) GMEM_EXCEP {
+void *gmalloc(size_t size) {
   return gmalloc(size, false);
 }
 
-void *gmalloc_checkoverflow(size_t size) GMEM_EXCEP {
+void *gmalloc_checkoverflow(size_t size) {
   return gmalloc(size, true);
 }
 
-inline static void *grealloc(void *p, size_t size, bool checkoverflow) GMEM_EXCEP {
+inline static void *grealloc(void *p, size_t size, bool checkoverflow) {
 #ifdef DEBUG_MEM
   GMemHdr *hdr;
   void *q;
@@ -169,27 +161,23 @@ inline static void *grealloc(void *p, size_t size, bool checkoverflow) GMEM_EXCE
     q = malloc(size);
   }
   if (!q) {
-#if USE_EXCEPTIONS
-    throw GMemException();
-#else
     fprintf(stderr, "Out of memory\n");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   return q;
 #endif
 }
 
-void *grealloc(void *p, size_t size) GMEM_EXCEP {
+void *grealloc(void *p, size_t size) {
   return grealloc(p, size, false);
 }
 
-void *grealloc_checkoverflow(void *p, size_t size) GMEM_EXCEP {
+void *grealloc_checkoverflow(void *p, size_t size) {
   return grealloc(p, size, true);
 }
 
-inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) GMEM_EXCEP {
+inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) {
   int n;
 
   if (nObjs == 0) {
@@ -197,48 +185,40 @@ inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) GMEM_EX
   }
   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");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   return gmalloc(n, checkoverflow);
 }
 
-void *gmallocn(int nObjs, int objSize) GMEM_EXCEP {
+void *gmallocn(int nObjs, int objSize) {
   return gmallocn(nObjs, objSize, false);
 }
 
-void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP {
+void *gmallocn_checkoverflow(int nObjs, int objSize) {
   return gmallocn(nObjs, objSize, true);
 }
 
-inline static void *gmallocn3(int a, int b, int c, bool checkoverflow) GMEM_EXCEP {
+inline static void *gmallocn3(int a, int b, int c, bool checkoverflow) {
   int n = a * b;
   if (b <= 0 || a < 0 || a >= INT_MAX / b) {
-#if USE_EXCEPTIONS
-    throw GMemException();
-#else
     fprintf(stderr, "Bogus memory allocation size\n");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   return gmallocn(n, c, checkoverflow);
 }
 
-void *gmallocn3(int a, int b, int c) GMEM_EXCEP {
+void *gmallocn3(int a, int b, int c) {
   return gmallocn3(a, b, c, false);
 }
 
-void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP {
+void *gmallocn3_checkoverflow(int a, int b, int c) {
   return gmallocn3(a, b, c, true);
 }
 
-inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflow) GMEM_EXCEP {
+inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflow) {
   int n;
 
   if (nObjs == 0) {
@@ -249,22 +229,18 @@ inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflo
   }
   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");
     if (checkoverflow) return NULL;
     else exit(1);
-#endif
   }
   return grealloc(p, n, checkoverflow);
 }
 
-void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP {
+void *greallocn(void *p, int nObjs, int objSize) {
   return greallocn(p, nObjs, objSize, false);
 }
 
-void *greallocn_checkoverflow(void *p, int nObjs, int objSize) GMEM_EXCEP {
+void *greallocn_checkoverflow(void *p, int nObjs, int objSize) {
   return greallocn(p, nObjs, objSize, true);
 }
 
diff --git a/goo/gmem.h b/goo/gmem.h
index ea75fb9..405c829 100644
--- a/goo/gmem.h
+++ b/goo/gmem.h
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Takashi Iwai <tiwai at suse.de>
-// Copyright (C) 2007-2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2010 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008 Jonathan Kew <jonathan_kew at sil.org>
 //
 // To see a description of the changes please see the Changelog file that
@@ -28,22 +28,6 @@
 #include <stdio.h>
 #include "poppler/poppler-config.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" {
 #endif
@@ -52,15 +36,15 @@ extern "C" {
  * Same as malloc, but prints error message and exits if malloc()
  * returns NULL.
  */
-extern void *gmalloc(size_t size) GMEM_EXCEP;
-extern void *gmalloc_checkoverflow(size_t size) GMEM_EXCEP;
+extern void *gmalloc(size_t size);
+extern void *gmalloc_checkoverflow(size_t size);
 
 /*
  * 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, size_t size) GMEM_EXCEP;
-extern void *grealloc_checkoverflow(size_t size) GMEM_EXCEP;
+extern void *grealloc(void *p, size_t size);
+extern void *grealloc_checkoverflow(size_t size);
 
 /*
  * These are similar to gmalloc and grealloc, but take an object count
@@ -70,12 +54,12 @@ extern void *grealloc_checkoverflow(size_t size) GMEM_EXCEP;
  * The gmallocn_checkoverflow variant returns NULL instead of exiting
  * the application if a overflow is detected
  */
-extern void *gmallocn(int nObjs, int objSize) GMEM_EXCEP;
-extern void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP;
-extern void *gmallocn3(int a, int b, int c) GMEM_EXCEP;
-extern void *gmallocn3_checkoverflow(int a, int b, int c) GMEM_EXCEP;
-extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP;
-extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize) GMEM_EXCEP;
+extern void *gmallocn(int nObjs, int objSize);
+extern void *gmallocn_checkoverflow(int nObjs, int objSize);
+extern void *gmallocn3(int a, int b, int c);
+extern void *gmallocn3_checkoverflow(int a, int b, int c);
+extern void *greallocn(void *p, int nObjs, int objSize);
+extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize);
 
 /*
  * Same as free, but checks for and ignores NULL pointers.
diff --git a/poppler/poppler-config.h.cmake b/poppler/poppler-config.h.cmake
index d049a12..2243498 100644
--- a/poppler/poppler-config.h.cmake
+++ b/poppler/poppler-config.h.cmake
@@ -19,11 +19,6 @@
 #cmakedefine MULTITHREADED 1
 #endif
 
-/* Enable exceptions. */
-#ifndef USE_EXCEPTIONS
-#cmakedefine USE_EXCEPTIONS 1
-#endif
-
 /* Use fixedpoint. */
 #ifndef USE_FIXEDPOINT
 #cmakedefine USE_FIXEDPOINT 1
diff --git a/poppler/poppler-config.h.in b/poppler/poppler-config.h.in
index 6fa873e..cc531e3 100644
--- a/poppler/poppler-config.h.in
+++ b/poppler/poppler-config.h.in
@@ -19,11 +19,6 @@
 #undef MULTITHREADED
 #endif
 
-/* Enable exceptions. */
-#ifndef USE_EXCEPTIONS
-#undef USE_EXCEPTIONS
-#endif
-
 /* Use fixedpoint. */
 #ifndef USE_FIXEDPOINT
 #undef USE_FIXEDPOINT
commit dd2e9399868e3dbf2fa4ede050f8d74d29ebbbb4
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 19 16:31:43 2010 +0100

    add uninstalled.pc to ignore

diff --git a/.gitignore b/.gitignore
index d000352..39728b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,10 @@ poppler.pc
 stamp-h1
 gtk-doc.make
 *.o
+poppler-cairo-uninstalled.pc
+poppler-cpp-uninstalled.pc
+poppler-glib-uninstalled.pc
+poppler-qt-uninstalled.pc
+poppler-qt4-uninstalled.pc
+poppler-splash-uninstalled.pc
+poppler-uninstalled.pc


More information about the poppler mailing list