[poppler] goo/GooLikely.h goo/Makefile.am poppler/Object.h splash/Splash.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Jun 15 15:06:19 PDT 2010


 goo/GooLikely.h  |   22 ++++++++++++++++++++++
 goo/Makefile.am  |    1 +
 poppler/Object.h |    9 +--------
 splash/Splash.cc |    4 +---
 4 files changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 38bf54bbad40288be763c6a1a89d90477c9ef89d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Jun 15 23:05:43 2010 +0100

    move the declaration of likely/unlikely to an own file in goo/

diff --git a/goo/GooLikely.h b/goo/GooLikely.h
new file mode 100644
index 0000000..724ccf0
--- /dev/null
+++ b/goo/GooLikely.h
@@ -0,0 +1,22 @@
+//========================================================================
+//
+// GooLikely.h
+//
+// This file is licensed under the GPLv2 or later
+//
+// Copyright (C) 2008 Kees Cook <kees at outflux.net>
+//
+//========================================================================
+
+#ifndef GOOLIKELY_H
+#define GOOLIKELY_H
+
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+# define likely(x)      __builtin_expect((x), 1)
+# define unlikely(x)    __builtin_expect((x), 0)
+#else
+# define likely(x)      (x)
+# define unlikely(x)    (x)
+#endif
+
+#endif
diff --git a/goo/Makefile.am b/goo/Makefile.am
index 39d2683..e15c7ac 100644
--- a/goo/Makefile.am
+++ b/goo/Makefile.am
@@ -17,6 +17,7 @@ poppler_goo_include_HEADERS =			\
 	PNGWriter.h				\
 	JpegWriter.h				\
 	ImgWriter.h				\
+	GooLikely.h				\
 	gstrtod.h
 
 endif
diff --git a/poppler/Object.h b/poppler/Object.h
index 2b9f20c..3038d0c 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -35,16 +35,9 @@
 #include "goo/gtypes.h"
 #include "goo/gmem.h"
 #include "goo/GooString.h"
+#include "goo/GooLikely.h"
 #include "Error.h"
 
-#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
-# define likely(x)      __builtin_expect((x), 1)
-# define unlikely(x)    __builtin_expect((x), 0)
-#else
-# define likely(x)      (x)
-# define unlikely(x)    (x)
-#endif
-
 #define OBJECT_TYPE_CHECK(wanted_type) \
     if (unlikely(type != wanted_type)) { \
         error(0, (char *) "Call to Object where the object was type %d, " \
diff --git a/splash/Splash.cc b/splash/Splash.cc
index bea4706..562c7cc 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -29,6 +29,7 @@
 #include <string.h>
 #include <limits.h>
 #include "goo/gmem.h"
+#include "goo/GooLikely.h"
 #include "SplashErrorCodes.h"
 #include "SplashMath.h"
 #include "SplashBitmap.h"
@@ -42,9 +43,6 @@
 #include "SplashGlyphBitmap.h"
 #include "Splash.h"
 
-// to get the unlikely definition
-#include "Object.h"
-
 //------------------------------------------------------------------------
 
 // distance of Bezier control point from center for circle approximation


More information about the poppler mailing list