[cairo-commit] 18 commits - src/cairo-freelist-private.h
src/cairo-mutex.c src/cairo-mutex-list-private.h
src/cairo-mutex-private.h src/cairo-truetype-subset.c
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Apr 19 13:38:42 PDT 2007
src/cairo-freelist-private.h | 2
src/cairo-mutex-list-private.h | 6 +-
src/cairo-mutex-private.h | 104 ++++++++++++++++++++++++++++++-----------
src/cairo-mutex.c | 4 -
src/cairo-truetype-subset.c | 2
5 files changed, 83 insertions(+), 35 deletions(-)
New commits:
diff-tree 3631c11eb4ab49f2bb3b9ef0478e5516793f221f (from d2a824a191e6b0d10a1f495d970b0406e37e0a39)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:38:23 2007 -0400
[cairo-mutex] Switch to HAVE_WINDOWS_H to use Win32 mutexes
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index e6fb79e..a8b09f4 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -75,7 +75,7 @@ typedef int cairo_mutex_t;
# define CAIRO_MUTEX_FINI(mutex) pthread_mutex_destroy (mutex)
# define CAIRO_MUTEX_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#elif CAIRO_HAS_WIN32_SURFACE /**********************************************/
+#elif HAVE_WINDOWS_H /*******************************************************/
/* We require Windows 2000 features. Although we don't use them here, things
* should still work if this header file ends up being the one to include
diff-tree d2a824a191e6b0d10a1f495d970b0406e37e0a39 (from 12dfd8bb4bf72483c835e169003fa00b114beb13)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:37:36 2007 -0400
[cairo-commit] Update attribution headers in cairo-mutex-private.h
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index ad0a941..e6fb79e 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -1,7 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
- * Copyright © 2005 Red Hat, Inc.
+ * Copyright © 2005,2007 Red Hat, Inc.
* Copyright © 2007 Mathias Hasselmann
*
* This library is free software; you can redistribute it and/or
@@ -35,6 +35,7 @@
* 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_PRIVATE_H
diff-tree 12dfd8bb4bf72483c835e169003fa00b114beb13 (from 6aa823841d6c1d59d4d972f0236f0e6a43199970)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:36:43 2007 -0400
[cairo-mutex] Warn if no mutex definition found and let sanity macros err
about undefined CAIRO_MUTEX macros.
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 5150b8e..ad0a941 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -134,10 +134,12 @@ typedef int cairo_mutex_t;
#else /**********************************************************************/
-# define CAIRO_MUTEX_LOCK(name)
-# define CAIRO_MUTEX_UNLOCK(name)
+# warning "XXX: No mutex implementation found. Define CAIRO_NO_MUTEX to 1" \
+ " to compile cairo without thread-safety support."
+
+#endif
+
-#endif /********************************************************************/
#ifndef CAIRO_MUTEX_DECLARE
#define CAIRO_MUTEX_DECLARE(name) extern cairo_mutex_t name;
diff-tree 6aa823841d6c1d59d4d972f0236f0e6a43199970 (from e5980f69ad2d59ee305fe9aae62070a74d2df58b)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:36:10 2007 -0400
[cairo-mutex] Support non-reentrant compilation if CAIRO_NO_MUTEX defined
to 1.
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index e0399c5..5150b8e 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -54,7 +54,15 @@ CAIRO_BEGIN_DECLS
-#if HAVE_PTHREAD_H /*********************************************************/
+#if CAIRO_NO_MUTEX
+
+typedef int cairo_mutex_t;
+# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
+# define CAIRO_MUTEX_LOCK(name) CAIRO_MUTEX_NOOP
+# define CAIRO_MUTEX_UNLOCK(name) CAIRO_MUTEX_NOOP
+# define CAIRO_MUTEX_NIL_INITIALIZER 0
+
+#elif HAVE_PTHREAD_H /*******************************************************/
# include <pthread.h>
diff-tree e5980f69ad2d59ee305fe9aae62070a74d2df58b (from 8ebb054ff9d2fe12faa7b1807aef24b2bf916e64)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:31:47 2007 -0400
[cairo-commit] Just warn for BeOS and let the sanity check macros err
about undefined CAIRO_MUTEX macros.
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index b62f9bf..e0399c5 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -120,13 +120,9 @@ CAIRO_BEGIN_DECLS
# define CAIRO_MUTEX_LOCK(name) _cairo_beos_lock (&name)
# define CAIRO_MUTEX_UNLOCK(name) _cairo_beos_unlock (&name)
-# error "XXX: Someone who understands BeOS needs to add definitions for" \
- " cairo_mutex_t, CAIRO_MUTEX_INIT, and CAIRO_MUTEX_FINI," \
- " to cairoint.h"
-
-# define CAIRO_MUTEX_INIT(mutex) ???
-# define CAIRO_MUTEX_FINI(mutex) ???
-# define CAIRO_MUTEX_NIL_INITIALIZER {}
+# warning "XXX: Someone who understands BeOS needs to add definitions for" \
+ " cairo_mutex_t, CAIRO_MUTEX_INIT, and CAIRO_MUTEX_FINI," \
+ " and CAIRO_MUTEX_NIL_INITIALIZER to cairo-mutex-private.h"
#else /**********************************************************************/
diff-tree 8ebb054ff9d2fe12faa7b1807aef24b2bf916e64 (from 97c197478023ceb5477a203d058eaec2cb18f987)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:28:44 2007 -0400
[cairo-mutex] Prefer "#if CAIRO_SOMETHING" over "#if defined CAIRO_SOMETHING"
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index bc0fcfc..b62f9bf 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -66,7 +66,7 @@ CAIRO_BEGIN_DECLS
# define CAIRO_MUTEX_FINI(mutex) pthread_mutex_destroy (mutex)
# define CAIRO_MUTEX_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#elif defined CAIRO_HAS_WIN32_SURFACE /**************************************/
+#elif CAIRO_HAS_WIN32_SURFACE /**********************************************/
/* We require Windows 2000 features. Although we don't use them here, things
* should still work if this header file ends up being the one to include
@@ -109,7 +109,7 @@ CAIRO_BEGIN_DECLS
} while (0)
# define CAIRO_MUTEX_NIL_INITIALIZER 0
-#elif defined CAIRO_HAS_BEOS_SURFACE /***************************************/
+#elif CAIRO_HAS_BEOS_SURFACE /***********************************************/
typedef void* cairo_mutex_t;
diff-tree 97c197478023ceb5477a203d058eaec2cb18f987 (from 6d2a2dd6d9190c62b209e47c083b7df72e7134fb)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:26:21 2007 -0400
[cairo-mutex] Add default implementation for CAIRO_MUTEX_INIT
that uses CAIRO_MUTEX_NIL_INITIALIZER. This used to be the
implementation for pthread because pthread_mutex_init() is
broken. See d48bb4fbe876a93199ba48fcf5f32734fbe18ba9.
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index ba9c39a..bc0fcfc 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -63,10 +63,6 @@ CAIRO_BEGIN_DECLS
# 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_INIT(mutex) do { \
- pthread_mutex_t tmp_mutex = PTHREAD_MUTEX_INITIALIZER; \
- memcpy (mutex, &tmp_mutex, sizeof (tmp_mutex)); \
-} while (0)
# define CAIRO_MUTEX_FINI(mutex) pthread_mutex_destroy (mutex)
# define CAIRO_MUTEX_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
@@ -146,6 +142,13 @@ CAIRO_BEGIN_DECLS
#undef CAIRO_MUTEX_DECLARE
+#ifndef CAIRO_MUTEX_INIT
+# define CAIRO_MUTEX_INIT(_mutex) do { \
+ cairo_mutex_t _tmp_mutex = CAIRO_MUTEX_NIL_INITIALIZER; \
+ memcpy ((_mutex), &_tmp_mutex, sizeof (_tmp_mutex)); \
+} while (0)
+#endif
+
#ifndef CAIRO_MUTEX_FINI
# define CAIRO_MUTEX_FINI(mutex) CAIRO_MUTEX_NOOP
#endif
diff-tree 6d2a2dd6d9190c62b209e47c083b7df72e7134fb (from 2067d6fa90dae80aa666fb7328d51e2f92bec5bd)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:24:16 2007 -0400
[cairo-mutex] Add default no-op implementation for CAIRO_MUTEX_FINI
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 00a1fe9..ba9c39a 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -145,6 +145,12 @@ CAIRO_BEGIN_DECLS
#include "cairo-mutex-list-private.h"
#undef CAIRO_MUTEX_DECLARE
+
+#ifndef CAIRO_MUTEX_FINI
+# define CAIRO_MUTEX_FINI(mutex) CAIRO_MUTEX_NOOP
+#endif
+
+
#ifndef CAIRO_MUTEX_INITIALIZE
# define CAIRO_MUTEX_USE_GENERIC_INITIALIZATION 1
#else
diff-tree 2067d6fa90dae80aa666fb7328d51e2f92bec5bd (from 5dda76c90f8886b6017ca8bbdf81be2b97201962)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:23:14 2007 -0400
[cairo-mutex] Use CAIRO_MUTEX_NOOP when applicable
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index e78f6f3..00a1fe9 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -60,7 +60,7 @@ CAIRO_BEGIN_DECLS
typedef pthread_mutex_t cairo_mutex_t;
-# define CAIRO_MUTEX_INITIALIZE() /* no-op */
+# 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_INIT(mutex) do { \
diff-tree 5dda76c90f8886b6017ca8bbdf81be2b97201962 (from f771b9157c26430949f4dd1412c7a7b35367f81a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:22:02 2007 -0400
[cairo-mutex] Err if at least one of mutex macros are not defined
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index bfdfcc7..e78f6f3 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -174,4 +174,27 @@ cairo_private void _cairo_mutex_finalize
CAIRO_END_DECLS
+/* Make sure everything we want is defined */
+#ifndef CAIRO_MUTEX_INITIALIZE
+# error "CAIRO_MUTEX_INITIALIZE not defined"
+#endif
+#ifndef CAIRO_MUTEX_FINALIZE
+# error "CAIRO_MUTEX_FINALIZE not defined"
+#endif
+#ifndef CAIRO_MUTEX_LOCK
+# error "CAIRO_MUTEX_LOCK not defined"
+#endif
+#ifndef CAIRO_MUTEX_UNLOCK
+# error "CAIRO_MUTEX_UNLOCK not defined"
+#endif
+#ifndef CAIRO_MUTEX_INIT
+# error "CAIRO_MUTEX_INIT not defined"
+#endif
+#ifndef CAIRO_MUTEX_FINI
+# error "CAIRO_MUTEX_FINI not defined"
+#endif
+#ifndef CAIRO_MUTEX_NIL_INITIALIZER
+# error "CAIRO_MUTEX_NIL_INITIALIZER not defined"
+#endif
+
#endif
diff-tree f771b9157c26430949f4dd1412c7a7b35367f81a (from 4fc52e2d49c1299f8f175e22472ebe08baa41fa4)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:21:13 2007 -0400
[cairo-mutex] Define and use CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
We use the generic initialization if CAIRO_MUTEX_INITIALIZE is not
defined.
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 059dec9..bfdfcc7 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -146,6 +146,15 @@ CAIRO_BEGIN_DECLS
#undef CAIRO_MUTEX_DECLARE
#ifndef CAIRO_MUTEX_INITIALIZE
+# define CAIRO_MUTEX_USE_GENERIC_INITIALIZATION 1
+#else
+# undef CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
+# ifndef CAIRO_MUTEX_FINALIZE
+# define CAIRO_MUTEX_FINALIZE CAIRO_MUTEX_NOOP
+# endif
+#endif
+
+#if CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
#define CAIRO_MUTEX_INITIALIZE() do { \
if (!_cairo_mutex_initialized) \
diff --git a/src/cairo-mutex.c b/src/cairo-mutex.c
index 60e1a08..69f4e50 100644
--- a/src/cairo-mutex.c
+++ b/src/cairo-mutex.c
@@ -36,7 +36,7 @@
#include "cairoint.h"
-#if !HAVE_PTHREAD_H
+#if CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
cairo_bool_t _cairo_mutex_initialized = FALSE;
diff-tree 4fc52e2d49c1299f8f175e22472ebe08baa41fa4 (from f9dd8fd0ef0ad95921723155b951cd113ccb2d0b)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:19:48 2007 -0400
[cairo-mutex] Define CAIRO_MUTEX_NOOP
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 09fda70..059dec9 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -48,6 +48,12 @@
CAIRO_BEGIN_DECLS
+
+/* A fully qualified no-operation statement */
+#define CAIRO_MUTEX_NOOP do {/*no-op*/} while (0)
+
+
+
#if HAVE_PTHREAD_H /*********************************************************/
# include <pthread.h>
diff-tree f9dd8fd0ef0ad95921723155b951cd113ccb2d0b (from 4e754cf3df9855c1d442578e555b7fb17c3dd4a1)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 16:19:25 2007 -0400
[cairo-mutex] Inlucde cairo-features.h and config.h
Previously we were lucky enough to have them included before us
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index d4dc735..09fda70 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -40,6 +40,12 @@
#ifndef CAIRO_MUTEX_PRIVATE_H
#define CAIRO_MUTEX_PRIVATE_H
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cairo-features.h>
+
CAIRO_BEGIN_DECLS
#if HAVE_PTHREAD_H /*********************************************************/
diff-tree 4e754cf3df9855c1d442578e555b7fb17c3dd4a1 (from 4141e752e2eb0f40f2eb298bad398e6390e00ef8)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 15:31:24 2007 -0400
[cairo-truetype-subset] Shut gcc warning up
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 8565fea..d791c63 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -915,7 +915,7 @@ cairo_status_t
_cairo_truetype_subset_init (cairo_truetype_subset_t *truetype_subset,
cairo_scaled_font_subset_t *font_subset)
{
- cairo_truetype_font_t *font;
+ cairo_truetype_font_t *font = NULL;
cairo_status_t status;
const char *data = NULL; /* squelch bogus compiler warning */
unsigned long length = 0; /* squelch bogus compiler warning */
diff-tree 4141e752e2eb0f40f2eb298bad398e6390e00ef8 (from ea817c560c429f445e4c450b60d499dae27f6024)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 15:04:11 2007 -0400
[cairo-freelist] Remove redundant struct declarations
diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h
index 41855f7..7e2036c 100644
--- a/src/cairo-freelist-private.h
+++ b/src/cairo-freelist-private.h
@@ -26,8 +26,6 @@
#include <stddef.h>
/* Opaque implementation types. */
-struct _cairo_freelist;
-struct _cairo_freelist_node;
typedef struct _cairo_freelist cairo_freelist_t;
typedef struct _cairo_freelist_node cairo_freelist_node_t;
diff-tree ea817c560c429f445e4c450b60d499dae27f6024 (from 0b281085b55aae70876c6ef022266b73461800ab)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 14:50:38 2007 -0400
[cairo-mutex] Remove unneeded #undef CAIRO_MUTEX_EXTERNAL
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 73ca9b3..d4dc735 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -130,11 +130,8 @@ CAIRO_BEGIN_DECLS
#ifndef CAIRO_MUTEX_DECLARE
#define CAIRO_MUTEX_DECLARE(name) extern cairo_mutex_t name;
#endif
-
#include "cairo-mutex-list-private.h"
-
#undef CAIRO_MUTEX_DECLARE
-#undef CAIRO_MUTEX_EXTERNAL
#ifndef CAIRO_MUTEX_INITIALIZE
@@ -157,8 +154,3 @@ cairo_private void _cairo_mutex_finalize
CAIRO_END_DECLS
#endif
-
-
-
-
-
diff-tree 0b281085b55aae70876c6ef022266b73461800ab (from 47be7280bfe751c9f635f1e17c158f04b2927ae3)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 14:45:41 2007 -0400
[cairo-mutex] Err on unintended inclusion of cairo-mutex-list-private.h
diff --git a/src/cairo-mutex-list-private.h b/src/cairo-mutex-list-private.h
index 949b0c5..7e65ddc 100644
--- a/src/cairo-mutex-list-private.h
+++ b/src/cairo-mutex-list-private.h
@@ -45,3 +45,6 @@ CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_
CAIRO_MUTEX_DECLARE (_cairo_xlib_screen_mutex);
#endif
+
+/* Undefine, to err on unintended inclusion */
+#undef CAIRO_MUTEX_DECLARE
diff-tree 47be7280bfe751c9f635f1e17c158f04b2927ae3 (from 55ea0466e25de2c60171a9d6c96536bc2e7fb9e3)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Apr 19 14:42:55 2007 -0400
[cairo-mutex] Remove multiple-inclusion guards from cairo-mutex-list-private.h
This is a list header file. We should not prevent it from multiple
inclusions.
diff --git a/src/cairo-mutex-list-private.h b/src/cairo-mutex-list-private.h
index 7d6086a..949b0c5 100644
--- a/src/cairo-mutex-list-private.h
+++ b/src/cairo-mutex-list-private.h
@@ -31,8 +31,6 @@
* Mathias Hasselmann <mathias.hasselmann at gmx.de>
*/
-#ifndef CAIRO_MUTEX_LIST_PRIVATE_H
-#define CAIRO_MUTEX_LIST_PRIVATE_H
CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_cache_lock);
@@ -47,4 +45,3 @@ CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_
CAIRO_MUTEX_DECLARE (_cairo_xlib_screen_mutex);
#endif
-#endif
diff --git a/src/cairo-mutex.c b/src/cairo-mutex.c
index 70cd31a..60e1a08 100644
--- a/src/cairo-mutex.c
+++ b/src/cairo-mutex.c
@@ -48,7 +48,6 @@ void _cairo_mutex_initialize (void)
_cairo_mutex_initialized = TRUE;
#define CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_INIT (&mutex);
-#undef CAIRO_MUTEX_LIST_PRIVATE_H
#include "cairo-mutex-list-private.h"
#undef CAIRO_MUTEX_DECLARE
}
@@ -61,7 +60,6 @@ void _cairo_mutex_finalize (void)
_cairo_mutex_initialized = FALSE;
#define CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_FINI (&mutex)
-#undef CAIRO_MUTEX_LIST_PRIVATE_H
#include "cairo-mutex-list-private.h"
#undef CAIRO_MUTEX_DECLARE
}
More information about the cairo-commit
mailing list