[evolution-kolab/ek-wip-porting: 36/36] CamelKolabImapxMetadata: GLib 2.32 GMutex fixups
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/ek-wip-porting: 36/36] CamelKolabImapxMetadata: GLib 2.32 GMutex fixups
- Date: Fri, 15 Jun 2012 12:50:48 +0000 (UTC)
commit 2a4096656757e6451076b64000deb609e38774a7
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Jun 15 14:47:26 2012 +0200
CamelKolabImapxMetadata: GLib 2.32 GMutex fixups
* g_mutex_new() / g_mutex_free() have been deprecated
in GLib 2.32 in favor of g_mutex_init() / g_mutex_clear()
src/camel/camel-imapx-metadata.c | 41 +++++++++++++++++--------------------
src/camel/camel-imapx-metadata.h | 5 +--
2 files changed, 21 insertions(+), 25 deletions(-)
---
diff --git a/src/camel/camel-imapx-metadata.c b/src/camel/camel-imapx-metadata.c
index 52121a0..671f664 100644
--- a/src/camel/camel-imapx-metadata.c
+++ b/src/camel/camel-imapx-metadata.c
@@ -151,10 +151,10 @@ camel_imapx_metadata_new (camel_imapx_metadata_proto_t proto,
g_assert (proto < CAMEL_IMAPX_METADATA_LAST_PROTO);
md = g_new0 (CamelImapxMetadata, 1);
- md->md_lock = g_mutex_new ();
+ g_mutex_init (&(md->md_lock));
if (locked)
- g_mutex_lock (md->md_lock);
+ g_mutex_lock (&(md->md_lock));
md->proto = proto;
md->mboxes = g_hash_table_new_full (g_str_hash,
@@ -173,9 +173,9 @@ camel_imapx_metadata_free (CamelImapxMetadata *md)
if (md->mboxes)
g_hash_table_destroy (md->mboxes);
- while (!g_mutex_trylock (md->md_lock));
- g_mutex_unlock (md->md_lock);
- g_mutex_free (md->md_lock);
+ while (! g_mutex_trylock (&(md->md_lock)));
+ g_mutex_unlock (&(md->md_lock));
+ g_mutex_clear (&(md->md_lock));
g_free (md);
}
@@ -184,13 +184,13 @@ CamelImapxMetadata*
camel_imapx_metadata_resect (CamelImapxMetadata **md)
{
CamelImapxMetadata *tmp_md = NULL;
- GMutex *tmp_lock = NULL;
+ GMutex tmp_lock;
if (md == NULL)
return NULL;
/* (acquire md lock) */
- g_mutex_lock ((*md)->md_lock);
+ g_mutex_lock (&((*md)->md_lock));
tmp_md = *md;
*md = camel_imapx_metadata_new (tmp_md->proto, FALSE);
@@ -201,7 +201,7 @@ camel_imapx_metadata_resect (CamelImapxMetadata **md)
(*md)->md_lock = tmp_lock; /* locked */
/* (release md lock) */
- g_mutex_unlock ((*md)->md_lock);
+ g_mutex_unlock (&((*md)->md_lock));
return tmp_md;
}
@@ -214,15 +214,13 @@ camel_imapx_metadata_get_proto (CamelImapxMetadata *md)
if (md == NULL)
return CAMEL_IMAPX_METADATA_PROTO_INVAL;
- g_assert (md->md_lock != NULL);
-
/* (acquire md lock) */
- g_mutex_lock (md->md_lock);
+ g_mutex_lock (&(md->md_lock));
mp = md->proto;
/* (acquire md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
return mp;
}
@@ -486,7 +484,7 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
/* (acquire md lock ) */
- g_mutex_lock (md->md_lock);
+ g_mutex_lock (&(md->md_lock));
switch (md->proto) {
case CAMEL_IMAPX_METADATA_PROTO_ANNOTATEMORE:
@@ -503,7 +501,7 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
break;
case CAMEL_IMAPX_METADATA_PROTO_INVAL:
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
g_set_error (err,
KOLAB_CAMEL_ERROR,
KOLAB_CAMEL_ERROR_GENERIC,
@@ -516,7 +514,7 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
}
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
if (!parse_ok) {
g_propagate_error (err, tmp_err);
@@ -527,7 +525,7 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
}
GSList*
-camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
+camel_imapx_metadata_new_commandlist (CamelImapxMetadata *md)
{
GSList *commands = NULL;
GHashTableIter md_iter;
@@ -537,13 +535,12 @@ camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
if (md == NULL)
return NULL;
- g_assert (md->md_lock != NULL);
/* (acquire md lock ) */
- g_mutex_lock (md->md_lock);
+ g_mutex_lock (&(md->md_lock));
if (md->mboxes == NULL) {
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
return NULL;
}
@@ -579,7 +576,7 @@ camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
break;
case CAMEL_IMAPX_METADATA_PROTO_INVAL:
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
if (commands != NULL)
g_slist_free (commands);
if (cmd != NULL)
@@ -638,7 +635,7 @@ camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
break;
case CAMEL_IMAPX_METADATA_PROTO_INVAL:
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
if (commands != NULL)
g_slist_free (commands);
if (cmd != NULL)
@@ -699,7 +696,7 @@ camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md)
}
/* (release md lock) */
- g_mutex_unlock (md->md_lock);
+ g_mutex_unlock (&(md->md_lock));
return commands;
}
diff --git a/src/camel/camel-imapx-metadata.h b/src/camel/camel-imapx-metadata.h
index 0aa5df9..e714393 100644
--- a/src/camel/camel-imapx-metadata.h
+++ b/src/camel/camel-imapx-metadata.h
@@ -107,8 +107,7 @@ typedef struct _CamelImapxMetadataAnnotation {
typedef struct _CamelImapxMetadata {
camel_imapx_metadata_proto_t proto;
GHashTable *mboxes;
- /* lock needed? */
- GMutex *md_lock;
+ GMutex md_lock;
} CamelImapxMetadata;
/*----------------------------------------------------------------------------*/
@@ -152,7 +151,7 @@ camel_imapx_metadata_add_from_server_response (CamelImapxMetadata *md,
GError**);
GSList*
-camel_imapx_metadata_new_commandlist (const CamelImapxMetadata *md);
+camel_imapx_metadata_new_commandlist (CamelImapxMetadata *md);
CamelImapxMetadataSpec*
camel_imapx_metadata_spec_new (camel_imapx_metadata_proto_t proto,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]