[cairo-commit] src/cairo-beos-surface.cpp src/cairo-font.c src/cairo-ft-font.c src/cairoint.h src/cairo-os2-surface.c src/cairo-scaled-font.c src/cairo-win32-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon Mar 5 12:59:49 PST 2007


 src/cairo-beos-surface.cpp |   12 ++++++------
 src/cairo-font.c           |   24 ++++++++++++------------
 src/cairo-ft-font.c        |   12 ++++++------
 src/cairo-os2-surface.c    |   30 +++++++++++++++---------------
 src/cairo-scaled-font.c    |   12 ++++++------
 src/cairo-win32-surface.c  |   18 +++++++++---------
 src/cairoint.h             |    2 +-
 7 files changed, 55 insertions(+), 55 deletions(-)

New commits:
diff-tree a487d094212d6bc4a06d5bfc774ba6d575165aa5 (from c8b84a4735c46a33620260de0618296df1e12574)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Mar 5 15:59:43 2007 -0500

    Rename all mutex variables to start with an underscore
    since they are not static in some of the implementations (win32, ...)

diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp
index 254ee24..066e389 100644
--- a/src/cairo-beos-surface.cpp
+++ b/src/cairo-beos-surface.cpp
@@ -985,19 +985,19 @@ cairo_beos_surface_create_for_bitmap (BV
 
 class BeLocks {
     public:
-	BLocker cairo_font_face_mutex;
-	BLocker cairo_scaled_font_map_mutex;
+	BLocker _cairo_font_face_mutex;
+	BLocker _cairo_scaled_font_map_mutex;
 #ifdef CAIRO_HAS_FT_FONT
-	BLocker cairo_ft_unscaled_font_map_mutex;
+	BLocker _cairo_ft_unscaled_font_map_mutex;
 #endif
 };
 
 static BeLocks locks;
 
-void* cairo_font_face_mutex = &locks.cairo_font_face_mutex;
-void* cairo_scaled_font_map_mutex = &locks.cairo_scaled_font_map_mutex;
+void* _cairo_font_face_mutex = &locks._cairo_font_face_mutex;
+void* _cairo_scaled_font_map_mutex = &locks._cairo_scaled_font_map_mutex;
 #ifdef CAIRO_HAS_FT_FONT
-void* cairo_ft_unscaled_font_map_mutex = &locks.cairo_ft_unscaled_font_map_mutex;
+void* _cairo_ft_unscaled_font_map_mutex = &locks._cairo_ft_unscaled_font_map_mutex;
 #endif
 
 void _cairo_beos_lock (void* locker) {
diff --git a/src/cairo-font.c b/src/cairo-font.c
index 33e7041..3f96e3b 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -68,7 +68,7 @@ _cairo_font_face_init (cairo_font_face_t
 
 /* This mutex protects both cairo_toy_font_hash_table as well as
    reference count manipulations for all cairo_font_face_t. */
-CAIRO_MUTEX_DECLARE (cairo_font_face_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_font_face_mutex);
 
 /**
  * cairo_font_face_reference:
@@ -93,7 +93,7 @@ cairo_font_face_reference (cairo_font_fa
     if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
 	return font_face;
 
-    CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
 
     /* We would normally assert (font_face->ref_count >0) here but we
      * can't get away with that due to the zombie case as documented
@@ -101,7 +101,7 @@ cairo_font_face_reference (cairo_font_fa
 
     font_face->ref_count++;
 
-    CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 
     return font_face;
 }
@@ -124,16 +124,16 @@ cairo_font_face_destroy (cairo_font_face
     if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
-    CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
 
     assert (font_face->ref_count > 0);
 
     if (--(font_face->ref_count) > 0) {
-        CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+        CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 	return;
     }
 
-    CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 
     font_face->backend->destroy (font_face);
 
@@ -266,14 +266,14 @@ _cairo_toy_font_face_keys_equal (const v
  * downstream caches, we don't need them in this hash table anymore.
  *
  * Modifications to this hash table are protected by
- * cairo_font_face_mutex.
+ * _cairo_font_face_mutex.
  */
 static cairo_hash_table_t *cairo_toy_font_face_hash_table = NULL;
 
 static cairo_hash_table_t *
 _cairo_toy_font_face_hash_table_lock (void)
 {
-    CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
 
     if (cairo_toy_font_face_hash_table == NULL)
     {
@@ -281,7 +281,7 @@ _cairo_toy_font_face_hash_table_lock (vo
 	    _cairo_hash_table_create (_cairo_toy_font_face_keys_equal);
 
 	if (cairo_toy_font_face_hash_table == NULL) {
-	    CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+	    CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 	    return NULL;
 	}
     }
@@ -292,7 +292,7 @@ _cairo_toy_font_face_hash_table_lock (vo
 static void
 _cairo_toy_font_face_hash_table_unlock (void)
 {
-    CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 }
 
 /**
@@ -515,8 +515,8 @@ _cairo_font_reset_static_data (void)
     /* We manually acquire the lock rather than calling
      * cairo_toy_font_face_hash_table_lock simply to avoid
      * creating the table only to destroy it again. */
-    CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
     _cairo_hash_table_destroy (cairo_toy_font_face_hash_table);
     cairo_toy_font_face_hash_table = NULL;
-    CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
 }
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 7650f47..27bc2e3 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -150,7 +150,7 @@ typedef struct _cairo_ft_unscaled_font_m
 
 static cairo_ft_unscaled_font_map_t *cairo_ft_unscaled_font_map = NULL;
 
-CAIRO_MUTEX_DECLARE(cairo_ft_unscaled_font_map_mutex);
+CAIRO_MUTEX_DECLARE(_cairo_ft_unscaled_font_map_mutex);
 
 static void
 _font_map_release_face_lock_held (cairo_ft_unscaled_font_map_t *font_map,
@@ -208,7 +208,7 @@ _cairo_ft_unscaled_font_map_destroy (voi
     cairo_ft_unscaled_font_t *unscaled;
     cairo_ft_unscaled_font_map_t *font_map;
 
-    CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
 
     if (cairo_ft_unscaled_font_map) {
 	font_map = cairo_ft_unscaled_font_map;
@@ -241,20 +241,20 @@ _cairo_ft_unscaled_font_map_destroy (voi
 	cairo_ft_unscaled_font_map = NULL;
     }
 
-    CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
 }
 
 static cairo_ft_unscaled_font_map_t *
 _cairo_ft_unscaled_font_map_lock (void)
 {
-    CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
 
     if (cairo_ft_unscaled_font_map == NULL)
     {
 	_cairo_ft_unscaled_font_map_create ();
 
 	if (cairo_ft_unscaled_font_map == NULL) {
-	    CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
+	    CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
 	    return NULL;
 	}
     }
@@ -265,7 +265,7 @@ _cairo_ft_unscaled_font_map_lock (void)
 static void
 _cairo_ft_unscaled_font_map_unlock (void)
 {
-    CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
 }
 
 static void
diff --git a/src/cairo-os2-surface.c b/src/cairo-os2-surface.c
index 3d46364..f6ec8f6 100644
--- a/src/cairo-os2-surface.c
+++ b/src/cairo-os2-surface.c
@@ -69,11 +69,11 @@
 static int cairo_os2_initialization_count = 0;
 
 /* The mutex semaphores Cairo uses all around: */
-HMTX cairo_scaled_font_map_mutex = 0;
+HMTX _cairo_scaled_font_map_mutex = 0;
 HMTX _global_image_glyph_cache_mutex = 0;
-HMTX cairo_font_face_mutex = 0;
+HMTX _cairo_font_face_mutex = 0;
 #ifdef CAIRO_HAS_FT_FONT
-HMTX cairo_ft_unscaled_font_map_mutex = 0;
+HMTX _cairo_ft_unscaled_font_map_mutex = 0;
 #endif
 
 static void inline
@@ -106,13 +106,13 @@ cairo_os2_init (void)
     /* Create the mutex semaphores we'll use! */
 
     /* cairo-font.c: */
-    DosCreateMutexSem (NULL, &cairo_scaled_font_map_mutex, 0, FALSE);
+    DosCreateMutexSem (NULL, &_cairo_scaled_font_map_mutex, 0, FALSE);
     DosCreateMutexSem (NULL, &_global_image_glyph_cache_mutex, 0, FALSE);
-    DosCreateMutexSem (NULL, &cairo_font_face_mutex, 0, FALSE);
+    DosCreateMutexSem (NULL, &_cairo_font_face_mutex, 0, FALSE);
 
 #ifdef CAIRO_HAS_FT_FONT
     /* cairo-ft-font.c: */
-    DosCreateMutexSem (NULL, &cairo_ft_unscaled_font_map_mutex, 0, FALSE);
+    DosCreateMutexSem (NULL, &_cairo_ft_unscaled_font_map_mutex, 0, FALSE);
 #endif
 
     /* Initialize FontConfig */
@@ -139,24 +139,24 @@ cairo_os2_fini (void)
 
     /* Destroy the mutex semaphores we've created! */
     /* cairo-font.c: */
-    if (cairo_scaled_font_map_mutex) {
-        DosCloseMutexSem (cairo_scaled_font_map_mutex);
-        cairo_scaled_font_map_mutex = 0;
+    if (_cairo_scaled_font_map_mutex) {
+        DosCloseMutexSem (_cairo_scaled_font_map_mutex);
+        _cairo_scaled_font_map_mutex = 0;
     }
     if (_global_image_glyph_cache_mutex) {
         DosCloseMutexSem (_global_image_glyph_cache_mutex);
         _global_image_glyph_cache_mutex = 0;
     }
-    if (cairo_font_face_mutex) {
-        DosCloseMutexSem (cairo_font_face_mutex);
-        cairo_font_face_mutex = 0;
+    if (_cairo_font_face_mutex) {
+        DosCloseMutexSem (_cairo_font_face_mutex);
+        _cairo_font_face_mutex = 0;
     }
 
 #ifdef CAIRO_HAS_FT_FONT
     /* cairo-ft-font.c: */
-    if (cairo_ft_unscaled_font_map_mutex) {
-        DosCloseMutexSem (cairo_ft_unscaled_font_map_mutex);
-        cairo_ft_unscaled_font_map_mutex = 0;
+    if (_cairo_ft_unscaled_font_map_mutex) {
+        DosCloseMutexSem (_cairo_ft_unscaled_font_map_mutex);
+        _cairo_ft_unscaled_font_map_mutex = 0;
     }
 #endif
 
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index c34a0cf..957edbb 100755
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -185,7 +185,7 @@ typedef struct _cairo_scaled_font_map {
 
 static cairo_scaled_font_map_t *cairo_scaled_font_map = NULL;
 
-CAIRO_MUTEX_DECLARE (cairo_scaled_font_map_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_scaled_font_map_mutex);
 
 static int
 _cairo_scaled_font_keys_equal (const void *abstract_key_a, const void *abstract_key_b);
@@ -193,7 +193,7 @@ _cairo_scaled_font_keys_equal (const voi
 static cairo_scaled_font_map_t *
 _cairo_scaled_font_map_lock (void)
 {
-    CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
 
     if (cairo_scaled_font_map == NULL) {
 	cairo_scaled_font_map = malloc (sizeof (cairo_scaled_font_map_t));
@@ -214,14 +214,14 @@ _cairo_scaled_font_map_lock (void)
  CLEANUP_SCALED_FONT_MAP:
     free (cairo_scaled_font_map);
  CLEANUP_MUTEX_LOCK:
-    CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
     return NULL;
 }
 
 static void
 _cairo_scaled_font_map_unlock (void)
 {
-   CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
+   CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
 }
 
 void
@@ -231,7 +231,7 @@ _cairo_scaled_font_map_destroy (void)
     cairo_scaled_font_map_t *font_map;
     cairo_scaled_font_t *scaled_font;
 
-    CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex);
+    CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
 
     font_map = cairo_scaled_font_map;
     if (font_map == NULL) {
@@ -256,7 +256,7 @@ _cairo_scaled_font_map_destroy (void)
     cairo_scaled_font_map = NULL;
 
  CLEANUP_MUTEX_LOCK:
-    CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
+    CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
 }
 
 /* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/)
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 24f84c7..9123b82 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1895,11 +1895,11 @@ static const cairo_surface_backend_t cai
  */
 #if !defined(HAVE_PTHREAD_H) 
 
-CRITICAL_SECTION cairo_scaled_font_map_mutex;
+CRITICAL_SECTION _cairo_scaled_font_map_mutex;
 #ifdef CAIRO_HAS_FT_FONT
-CRITICAL_SECTION cairo_ft_unscaled_font_map_mutex;
+CRITICAL_SECTION _cairo_ft_unscaled_font_map_mutex;
 #endif
-CRITICAL_SECTION cairo_font_face_mutex;
+CRITICAL_SECTION _cairo_font_face_mutex;
 
 static int _cairo_win32_initialized = 0;
 
@@ -1909,11 +1909,11 @@ _cairo_win32_initialize (void) {
 	return;
 
     /* every 'mutex' from CAIRO_MUTEX_DECALRE needs to be initialized here */
-    InitializeCriticalSection (&cairo_scaled_font_map_mutex);
+    InitializeCriticalSection (&_cairo_scaled_font_map_mutex);
 #ifdef CAIRO_HAS_FT_FONT
-    InitializeCriticalSection (&cairo_ft_unscaled_font_map_mutex);
+    InitializeCriticalSection (&_cairo_ft_unscaled_font_map_mutex);
 #endif
-    InitializeCriticalSection (&cairo_font_face_mutex);
+    InitializeCriticalSection (&_cairo_font_face_mutex);
 
     _cairo_win32_initialized = 1;
 }
@@ -1930,11 +1930,11 @@ DllMain (HINSTANCE hinstDLL,
     _cairo_win32_initialize();
     break;
   case DLL_PROCESS_DETACH:
-    DeleteCriticalSection (&cairo_scaled_font_map_mutex);
+    DeleteCriticalSection (&_cairo_scaled_font_map_mutex);
 #ifdef CAIRO_HAS_FT_FONT
-    DeleteCriticalSection (&cairo_ft_unscaled_font_map_mutex);
+    DeleteCriticalSection (&_cairo_ft_unscaled_font_map_mutex);
 #endif
-    DeleteCriticalSection (&cairo_font_face_mutex);
+    DeleteCriticalSection (&_cairo_font_face_mutex);
     break;
   }
   return TRUE;
diff --git a/src/cairoint.h b/src/cairoint.h
index 3a2d845..19897ff 100755
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -563,7 +563,7 @@ struct _cairo_scaled_font {
      * 1. The reference count (scaled_font->ref_count)
      *
      *    Modifications to the reference count are protected by the
-     *    cairo_scaled_font_map_mutex. This is because the reference
+     *    _cairo_scaled_font_map_mutex. This is because the reference
      *    count of a scaled font is intimately related with the font
      *    map itself, (and the magic holdovers array).
      *


More information about the cairo-commit mailing list