[cairo-commit] src/cairo-mutex-private.h src/cairo-mutex-type-private.h src/cairo-scaled-font-private.h src/Makefile.am

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Apr 30 21:41:28 PDT 2007


 src/Makefile.am                 |    1 
 src/cairo-mutex-private.h       |   81 ------------------------
 src/cairo-mutex-type-private.h  |  131 ++++++++++++++++++++++++++++++++++++++++
 src/cairo-scaled-font-private.h |    2 
 4 files changed, 135 insertions(+), 80 deletions(-)

New commits:
diff-tree f7cdbd385a02d023e35357cd27dcc165ada667f2 (from 6de0f2d15775a451ead2cc3e80530b7dc6b321a3)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue May 1 00:41:07 2007 -0400

    [cairo-mutex-private.h] Move implementation-specific parts to cairo-mutex-type-private.h
    
    This fixes the problem reported by Dave Yeo that boilerplate wasn't building:
    
    In file included from ../src/cairo-scaled-font-private.h:44,
    	     from cairo-boilerplate.c:65:
    ../src/cairo-mutex-private.h:183: error: syntax error before "extern"
    ../src/cairo-mutex-private.h:184: error: syntax error before "void"
    ../src/cairo-mutex-private.h:185: error: syntax error before "void"
    make[3]: *** [cairo-boilerplate.lo] Error 1

diff --git a/src/Makefile.am b/src/Makefile.am
index 664698e..ae1b6dc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -192,6 +192,7 @@ libcairo_la_SOURCES =				\
 	cairo-mutex.c				\
 	cairo-mutex-list-private.h		\
 	cairo-mutex-private.h			\
+	cairo-mutex-type-private.h		\
 	cairo-operator.c			\
 	cairo-path.c				\
 	cairo-path-private.h			\
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 28c315d..67a52b8 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -47,86 +47,9 @@
 
 #include <cairo-features.h>
 
-CAIRO_BEGIN_DECLS
-
-
-/* A fully qualified no-operation statement */
-#define CAIRO_MUTEX_NOOP	do {/*no-op*/} while (0)
-
-
-
-#if CAIRO_NO_MUTEX
-
-/* A poor man's mutex */
-
-  typedef int cairo_mutex_t;
-
-# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
-# define CAIRO_MUTEX_LOCK(name) do { while (name) ; (name) = 1; } while (0)
-# define CAIRO_MUTEX_UNLOCK(name) (name) = 0
-# define CAIRO_MUTEX_NIL_INITIALIZER 0
-
-#elif HAVE_PTHREAD_H /*******************************************************/
-
-# include <pthread.h>
-
-  typedef pthread_mutex_t cairo_mutex_t;
-
-# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
-# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&(name))
-# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&(name))
-# define CAIRO_MUTEX_FINI(mutex) pthread_mutex_destroy (mutex)
-# define CAIRO_MUTEX_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-
-#elif HAVE_WINDOWS_H /*******************************************************/
-
-# include <windows.h>
-
-  typedef CRITICAL_SECTION cairo_mutex_t;
-
-# define CAIRO_MUTEX_LOCK(name) EnterCriticalSection (&(name))
-# define CAIRO_MUTEX_UNLOCK(name) LeaveCriticalSection (&(name))
-# define CAIRO_MUTEX_INIT(mutex) InitializeCriticalSection (mutex)
-# define CAIRO_MUTEX_FINI(mutex) DeleteCriticalSection (mutex)
-# define CAIRO_MUTEX_NIL_INITIALIZER { NULL, 0, 0, NULL, NULL, 0 }
-
-#elif defined __OS2__ /******************************************************/
-
-# define INCL_BASE
-# define INCL_PM
-# include <os2.h>
-
-  typedef HMTX cairo_mutex_t;
-
-# define CAIRO_MUTEX_LOCK(name) DosRequestMutexSem(name, SEM_INDEFINITE_WAIT)
-# define CAIRO_MUTEX_UNLOCK(name) DosReleaseMutexSem(name)
-# define CAIRO_MUTEX_INIT(mutex) DosCreateMutexSem (NULL, mutex, 0L, FALSE)
-# define CAIRO_MUTEX_FINI(mutex) do {				\
-    if (0 != (mutex)) {						\
-        DosCloseMutexSem (*(mutex));				\
-        (*(mutex)) = 0;						\
-    }								\
-} while (0)
-# define CAIRO_MUTEX_NIL_INITIALIZER 0
-
-#elif CAIRO_HAS_BEOS_SURFACE /***********************************************/
-
-  typedef BLocker* cairo_mutex_t;
-
-# define CAIRO_MUTEX_LOCK(name) (name)->Lock()
-# define CAIRO_MUTEX_UNLOCK(name) (name)->Unlock()
-# define CAIRO_MUTEX_INIT(mutex) (*(mutex)) = new BLocker()
-# define CAIRO_MUTEX_FINI(mutex) delete (*(mutex))
-# define CAIRO_MUTEX_NIL_INITIALIZER NULL
-
-#else /**********************************************************************/
-
-# error "XXX: No mutex implementation found.  Define CAIRO_NO_MUTEX to 1" \
-        "     to compile cairo without thread-safety support."
-
-#endif
-
+#include "cairo-mutex-type-private.h"
 
+CAIRO_BEGIN_DECLS
 
 #ifndef CAIRO_MUTEX_DECLARE
 #define CAIRO_MUTEX_DECLARE(name) extern cairo_mutex_t name;
diff --git a/src/cairo-mutex-type-private.h b/src/cairo-mutex-type-private.h
new file mode 100644
index 0000000..0481c22
--- /dev/null
+++ b/src/cairo-mutex-type-private.h
@@ -0,0 +1,131 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005,2007 Red Hat, Inc.
+ * Copyright © 2007 Mathias Hasselmann
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ *	Carl D. Worth <cworth at cworth.org>
+ *	Mathias Hasselmann <mathias.hasselmann at gmx.de>
+ *	Behdad Esfahbod <behdad at behdad.org>
+ */
+
+#ifndef CAIRO_MUTEX_TYPE_PRIVATE_H
+#define CAIRO_MUTEX_TYPE_PRIVATE_H
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cairo-features.h>
+
+CAIRO_BEGIN_DECLS
+
+
+/* A fully qualified no-operation statement */
+#define CAIRO_MUTEX_NOOP	do {/*no-op*/} while (0)
+
+
+
+#if CAIRO_NO_MUTEX
+
+/* A poor man's mutex */
+
+  typedef int cairo_mutex_t;
+
+# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
+# define CAIRO_MUTEX_LOCK(name) do { while (name) ; (name) = 1; } while (0)
+# define CAIRO_MUTEX_UNLOCK(name) (name) = 0
+# define CAIRO_MUTEX_NIL_INITIALIZER 0
+
+#elif HAVE_PTHREAD_H /*******************************************************/
+
+# include <pthread.h>
+
+  typedef pthread_mutex_t cairo_mutex_t;
+
+# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
+# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&(name))
+# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&(name))
+# define CAIRO_MUTEX_FINI(mutex) pthread_mutex_destroy (mutex)
+# define CAIRO_MUTEX_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+
+#elif HAVE_WINDOWS_H /*******************************************************/
+
+# include <windows.h>
+
+  typedef CRITICAL_SECTION cairo_mutex_t;
+
+# define CAIRO_MUTEX_LOCK(name) EnterCriticalSection (&(name))
+# define CAIRO_MUTEX_UNLOCK(name) LeaveCriticalSection (&(name))
+# define CAIRO_MUTEX_INIT(mutex) InitializeCriticalSection (mutex)
+# define CAIRO_MUTEX_FINI(mutex) DeleteCriticalSection (mutex)
+# define CAIRO_MUTEX_NIL_INITIALIZER { NULL, 0, 0, NULL, NULL, 0 }
+
+#elif defined __OS2__ /******************************************************/
+
+# define INCL_BASE
+# define INCL_PM
+# include <os2.h>
+
+  typedef HMTX cairo_mutex_t;
+
+# define CAIRO_MUTEX_LOCK(name) DosRequestMutexSem(name, SEM_INDEFINITE_WAIT)
+# define CAIRO_MUTEX_UNLOCK(name) DosReleaseMutexSem(name)
+# define CAIRO_MUTEX_INIT(mutex) DosCreateMutexSem (NULL, mutex, 0L, FALSE)
+# define CAIRO_MUTEX_FINI(mutex) do {				\
+    if (0 != (mutex)) {						\
+        DosCloseMutexSem (*(mutex));				\
+        (*(mutex)) = 0;						\
+    }								\
+} while (0)
+# define CAIRO_MUTEX_NIL_INITIALIZER 0
+
+#elif CAIRO_HAS_BEOS_SURFACE /***********************************************/
+
+  typedef BLocker* cairo_mutex_t;
+
+# define CAIRO_MUTEX_LOCK(name) (name)->Lock()
+# define CAIRO_MUTEX_UNLOCK(name) (name)->Unlock()
+# define CAIRO_MUTEX_INIT(mutex) (*(mutex)) = new BLocker()
+# define CAIRO_MUTEX_FINI(mutex) delete (*(mutex))
+# define CAIRO_MUTEX_NIL_INITIALIZER NULL
+
+#else /**********************************************************************/
+
+# error "XXX: No mutex implementation found.  Define CAIRO_NO_MUTEX to 1" \
+        "     to compile cairo without thread-safety support."
+
+#endif
+
+CAIRO_END_DECLS
+
+#endif
diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h
index 6ff416d..fa71644 100644
--- a/src/cairo-scaled-font-private.h
+++ b/src/cairo-scaled-font-private.h
@@ -41,7 +41,7 @@
 #include "cairo.h"
 
 #include "cairo-types-private.h"
-#include "cairo-mutex-private.h"
+#include "cairo-mutex-type-private.h"
 
 struct _cairo_scaled_font {
     /* For most cairo objects, the rule for multiple threads is that


More information about the cairo-commit mailing list