[glib-networking] Update for glib 2.31 GMutex API changes



commit 481209f862463450b30c3abb25dfc3b7b5cf9f79
Author: Dan Winship <danw gnome org>
Date:   Tue Oct 25 09:08:43 2011 -0400

    Update for glib 2.31 GMutex API changes

 proxy/gnome/gproxyresolvergnome.c    |   14 +++++++-------
 tls/gnutls/gtlsbackend-gnutls.c      |   10 +++++-----
 tls/gnutls/gtlsfiledatabase-gnutls.c |   30 +++++++++++++++---------------
 3 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/proxy/gnome/gproxyresolvergnome.c b/proxy/gnome/gproxyresolvergnome.c
index 2148c68..fdde3de 100644
--- a/proxy/gnome/gproxyresolvergnome.c
+++ b/proxy/gnome/gproxyresolvergnome.c
@@ -86,7 +86,7 @@ struct _GProxyResolverGnome {
 
   GDBusProxy *pacrunner;
 
-  GMutex *lock;
+  GMutex lock;
 };
 
 static void g_proxy_resolver_gnome_iface_init (GProxyResolverInterface *iface);
@@ -129,9 +129,9 @@ gsettings_changed (GSettings   *settings,
 {
   GProxyResolverGnome *resolver = user_data;
 
-  g_mutex_lock (resolver->lock);
+  g_mutex_lock (&resolver->lock);
   resolver->need_update = TRUE;
-  g_mutex_unlock (resolver->lock);
+  g_mutex_unlock (&resolver->lock);
 }
 
 static void
@@ -172,7 +172,7 @@ g_proxy_resolver_gnome_finalize (GObject *object)
   if (resolver->pacrunner)
     g_object_unref (resolver->pacrunner);
 
-  g_mutex_free (resolver->lock);
+  g_mutex_clear (&resolver->lock);
 
   G_OBJECT_CLASS (g_proxy_resolver_gnome_parent_class)->finalize (object);
 }
@@ -180,7 +180,7 @@ g_proxy_resolver_gnome_finalize (GObject *object)
 static void
 g_proxy_resolver_gnome_init (GProxyResolverGnome *resolver)
 {
-  resolver->lock = g_mutex_new ();
+  g_mutex_init (&resolver->lock);
 
   resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA);
   g_signal_connect (resolver->proxy_settings, "changed",
@@ -513,10 +513,10 @@ g_proxy_resolver_gnome_lookup (GProxyResolver  *proxy_resolver,
   gchar **proxies = NULL;
   gushort port;
 
-  g_mutex_lock (resolver->lock);
+  g_mutex_lock (&resolver->lock);
   if (resolver->need_update)
     update_settings (resolver);
-  g_mutex_unlock (resolver->lock);
+  g_mutex_unlock (&resolver->lock);
 
   if (resolver->mode == G_DESKTOP_PROXY_MODE_NONE)
     goto done;
diff --git a/tls/gnutls/gtlsbackend-gnutls.c b/tls/gnutls/gtlsbackend-gnutls.c
index c7c4ba3..fb026bb 100644
--- a/tls/gnutls/gtlsbackend-gnutls.c
+++ b/tls/gnutls/gtlsbackend-gnutls.c
@@ -36,7 +36,7 @@
 
 struct _GTlsBackendGnutlsPrivate
 {
-  GMutex *mutex;
+  GMutex mutex;
   GTlsDatabase *default_database;
 };
 
@@ -141,7 +141,7 @@ g_tls_backend_gnutls_init (GTlsBackendGnutls *backend)
   g_once (&gnutls_inited, gtls_gnutls_init, NULL);
 
   backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (backend, G_TYPE_TLS_BACKEND_GNUTLS, GTlsBackendGnutlsPrivate);
-  backend->priv->mutex = g_mutex_new ();
+  g_mutex_init (&backend->priv->mutex);
 }
 
 static void
@@ -151,7 +151,7 @@ g_tls_backend_gnutls_finalize (GObject *object)
 
   if (backend->priv->default_database)
     g_object_unref (backend->priv->default_database);
-  g_mutex_free (backend->priv->mutex);
+  g_mutex_clear (&backend->priv->mutex);
 
   G_OBJECT_CLASS (g_tls_backend_gnutls_parent_class)->finalize (object);
 }
@@ -177,7 +177,7 @@ g_tls_backend_gnutls_get_default_database (GTlsBackend *backend)
   GTlsDatabase *result;
   GError *error = NULL;
 
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
 
   if (self->priv->default_database)
     {
@@ -201,7 +201,7 @@ g_tls_backend_gnutls_get_default_database (GTlsBackend *backend)
         }
     }
 
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   return result;
 }
diff --git a/tls/gnutls/gtlsfiledatabase-gnutls.c b/tls/gnutls/gtlsfiledatabase-gnutls.c
index 6dbfcc9..49ce6d2 100644
--- a/tls/gnutls/gtlsfiledatabase-gnutls.c
+++ b/tls/gnutls/gtlsfiledatabase-gnutls.c
@@ -50,7 +50,7 @@ struct _GTlsFileDatabaseGnutlsPrivate
   gchar *anchor_filename;
 
   /* protected by mutex */
-  GMutex *mutex;
+  GMutex mutex;
 
   /*
    * These are hash tables of GByteArray -> GPtrArray<GByteArray>. The values of
@@ -305,7 +305,7 @@ g_tls_file_database_gnutls_finalize (GObject *object)
   g_free (self->priv->anchor_filename);
   self->priv->anchor_filename = NULL;
 
-  g_mutex_free (self->priv->mutex);
+  g_mutex_clear (&self->priv->mutex);
 
   G_OBJECT_CLASS (g_tls_file_database_gnutls_parent_class)->finalize (object);
 }
@@ -362,7 +362,7 @@ g_tls_file_database_gnutls_init (GTlsFileDatabaseGnutls *self)
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
                                             G_TYPE_TLS_FILE_DATABASE_GNUTLS,
                                             GTlsFileDatabaseGnutlsPrivate);
-  self->priv->mutex = g_mutex_new ();
+  g_mutex_init (&self->priv->mutex);
 }
 
 static gchar*
@@ -377,12 +377,12 @@ g_tls_file_database_gnutls_create_certificate_handle (GTlsDatabase            *d
   g_object_get (certificate, "certificate", &der, NULL);
   g_return_val_if_fail (der, FALSE);
 
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
 
   /* At the same time look up whether this certificate is in list */
   contains = g_hash_table_lookup (self->priv->complete, der) ? TRUE : FALSE;
 
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   /* Certificate is in the database */
   if (contains)
@@ -410,7 +410,7 @@ g_tls_file_database_gnutls_lookup_certificate_for_handle (GTlsDatabase
   if (!handle)
     return NULL;
 
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
 
   /* Create the handles table if not already done */
   if (!self->priv->handles)
@@ -419,7 +419,7 @@ g_tls_file_database_gnutls_lookup_certificate_for_handle (GTlsDatabase
 
     der = g_hash_table_lookup (self->priv->handles, handle);
 
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   if (der == NULL)
     return NULL;
@@ -461,9 +461,9 @@ g_tls_file_database_gnutls_lookup_assertion (GTlsDatabaseGnutls          *databa
   g_object_get (certificate, "certificate", &der, NULL);
   g_return_val_if_fail (der, FALSE);
 
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
   contains = g_hash_table_lookup (self->priv->complete, der) ? TRUE : FALSE;
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   g_byte_array_unref (der);
 
@@ -512,9 +512,9 @@ g_tls_file_database_gnutls_lookup_certificate_issuer (GTlsDatabase           *da
   gnutls_free (dn.data);
 
   /* Find the full DER value of the certificate */
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
   der = multi_byte_array_hash_lookup_one (self->priv->subjects, subject);
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   g_byte_array_unref (subject);
 
@@ -555,9 +555,9 @@ g_tls_file_database_gnutls_lookup_certificates_issued_by (GTlsDatabase
     return NULL;
 
   /* Find the full DER value of the certificate */
-  g_mutex_lock (self->priv->mutex);
+  g_mutex_lock (&self->priv->mutex);
   ders = multi_byte_array_hash_lookup_all (self->priv->issuers, issuer_raw_dn);
-  g_mutex_unlock (self->priv->mutex);
+  g_mutex_unlock (&self->priv->mutex);
 
   for (i = 0; ders && i < ders->len; i++)
     {
@@ -634,7 +634,7 @@ g_tls_file_database_gnutls_initable_init (GInitable    *initable,
 
   if (result)
     {
-      g_mutex_lock (self->priv->mutex);
+      g_mutex_lock (&self->priv->mutex);
       if (!self->priv->subjects)
         {
           self->priv->subjects = subjects;
@@ -650,7 +650,7 @@ g_tls_file_database_gnutls_initable_init (GInitable    *initable,
           self->priv->complete = complete;
           complete = NULL;
         }
-      g_mutex_unlock (self->priv->mutex);
+      g_mutex_unlock (&self->priv->mutex);
     }
 
   if (subjects != NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]