[evolution-data-server] camel_folder_summary_(un)lock: Remove 'lock' enum argument.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] camel_folder_summary_(un)lock: Remove 'lock' enum argument.
- Date: Mon, 23 Sep 2013 16:07:03 +0000 (UTC)
commit 1a1270e5d660223dad9dceee1cdf989038be03db
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Sep 22 07:39:59 2013 -0400
camel_folder_summary_(un)lock: Remove 'lock' enum argument.
CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK is the only remaining option.
camel/camel-folder-summary.c | 186 +++++++++++++---------------
camel/camel-folder-summary.h | 6 +-
camel/camel-vee-summary.c | 20 ++--
camel/providers/local/camel-mbox-summary.c | 50 ++++----
camel/providers/local/camel-mh-summary.c | 5 -
5 files changed, 121 insertions(+), 146 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index aa91eb0..29c565a 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -177,14 +177,14 @@ remove_all_loaded (CamelFolderSummary *summary)
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_hash_table_foreach_remove (summary->priv->loaded_infos, remove_each_item, &to_remove_infos);
g_slist_foreach (to_remove_infos, (GFunc) camel_message_info_unref, NULL);
g_slist_free (to_remove_infos);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
static void
@@ -857,7 +857,7 @@ camel_folder_summary_replace_flags (CamelFolderSummary *summary,
summary_object = G_OBJECT (summary);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_object_freeze_notify (summary_object);
old_flags = GPOINTER_TO_UINT (g_hash_table_lookup (summary->priv->uids, camel_message_info_uid
(info)));
@@ -865,7 +865,7 @@ camel_folder_summary_replace_flags (CamelFolderSummary *summary,
if ((old_flags & ~CAMEL_MESSAGE_FOLDER_FLAGGED) == (new_flags & ~CAMEL_MESSAGE_FOLDER_FLAGGED)) {
g_object_thaw_notify (summary_object);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -909,7 +909,7 @@ camel_folder_summary_replace_flags (CamelFolderSummary *summary,
GUINT_TO_POINTER (new_flags));
g_object_thaw_notify (summary_object);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return changed;
}
@@ -1110,7 +1110,7 @@ info_set_flags (CamelMessageInfo *info,
}
if (mi->summary) {
- camel_folder_summary_lock (mi->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (mi->summary);
g_object_freeze_notify (G_OBJECT (mi->summary));
counts_changed = camel_folder_summary_replace_flags (mi->summary, info);
}
@@ -1118,14 +1118,14 @@ info_set_flags (CamelMessageInfo *info,
if (!counts_changed && ((old & ~CAMEL_MESSAGE_SYSTEM_MASK) == (mi->flags &
~CAMEL_MESSAGE_SYSTEM_MASK)) && !((set & CAMEL_MESSAGE_JUNK_LEARN) && !(set & CAMEL_MESSAGE_JUNK))) {
if (mi->summary) {
g_object_thaw_notify (G_OBJECT (mi->summary));
- camel_folder_summary_unlock (mi->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (mi->summary);
}
return FALSE;
}
if (mi->summary) {
g_object_thaw_notify (G_OBJECT (mi->summary));
- camel_folder_summary_unlock (mi->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (mi->summary);
}
if (mi->summary && mi->summary->priv->folder && mi->uid) {
@@ -1596,12 +1596,12 @@ camel_folder_summary_next_uid (CamelFolderSummary *summary)
{
guint32 uid;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
uid = summary->priv->nextuid++;
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return uid;
}
@@ -1619,12 +1619,12 @@ void
camel_folder_summary_set_next_uid (CamelFolderSummary *summary,
guint32 uid)
{
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
summary->priv->nextuid = MAX (summary->priv->nextuid, uid);
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/**
@@ -1644,11 +1644,11 @@ camel_folder_summary_get_next_uid (CamelFolderSummary *summary)
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), 0);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
res = summary->priv->nextuid;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -1712,11 +1712,11 @@ camel_folder_summary_check_uid (CamelFolderSummary *summary,
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
g_return_val_if_fail (uid != NULL, FALSE);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
ret = g_hash_table_lookup_extended (summary->priv->uids, uid, NULL, NULL);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return ret;
}
@@ -1749,12 +1749,12 @@ camel_folder_summary_get_array (CamelFolderSummary *summary)
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), NULL);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
res = g_ptr_array_sized_new (g_hash_table_size (summary->priv->uids));
g_hash_table_foreach (summary->priv->uids, folder_summary_dupe_uids_to_array, res);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -1807,13 +1807,13 @@ camel_folder_summary_get_hash (CamelFolderSummary *summary)
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), NULL);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
/* using direct hash because of strings being from the string pool */
uids = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify) camel_pstring_free,
NULL);
g_hash_table_foreach (summary->priv->uids, cfs_copy_uids_cb, uids);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return uids;
}
@@ -1852,7 +1852,7 @@ message_info_from_uid (CamelFolderSummary *summary,
CamelMessageInfo *info;
gint ret;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
info = g_hash_table_lookup (summary->priv->loaded_infos, uid);
@@ -1865,8 +1865,7 @@ message_info_from_uid (CamelFolderSummary *summary,
folder_name = camel_folder_get_full_name (summary->priv->folder);
if (is_in_memory_summary (summary)) {
- camel_folder_summary_unlock (
- summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
g_warning (
"%s: Tried to load uid '%s' "
"from DB on in-memory summary of '%s'",
@@ -1889,8 +1888,7 @@ message_info_from_uid (CamelFolderSummary *summary,
g_hash_table_destroy (data.columns_hash);
if (ret != 0) {
- camel_folder_summary_unlock (
- summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return NULL;
}
@@ -1903,7 +1901,7 @@ message_info_from_uid (CamelFolderSummary *summary,
if (info)
camel_message_info_ref (info);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return info;
}
@@ -1993,9 +1991,9 @@ camel_folder_summary_get_changed (CamelFolderSummary *summary)
* We need to have collate or something to get the modified ones
* from DB and merge */
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_hash_table_foreach (summary->priv->loaded_infos, (GHFunc) append_changed_uids, res);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -2014,9 +2012,9 @@ cfs_count_dirty (CamelFolderSummary *summary)
{
gint count = 0;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_hash_table_foreach (summary->priv->loaded_infos, (GHFunc) count_changed_uids, &count);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return count;
}
@@ -2047,14 +2045,14 @@ remove_cache (CamelSession *session,
if (time (NULL) - summary->priv->cache_load_time < SUMMARY_CACHE_DROP)
return;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_hash_table_foreach_remove (summary->priv->loaded_infos, (GHRFunc) remove_item, &to_remove_infos);
g_slist_foreach (to_remove_infos, (GFunc) camel_message_info_unref, NULL);
g_slist_free (to_remove_infos);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
summary->priv->cache_load_time = time (NULL);
}
@@ -2220,9 +2218,9 @@ preview_update (CamelSession *session,
g_hash_table_destroy (preview_data);
}
- camel_folder_summary_lock (folder->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (folder->summary);
g_hash_table_foreach (folder->summary->priv->loaded_infos, (GHFunc) pick_uids, uids_uncached);
- camel_folder_summary_unlock (folder->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (folder->summary);
for (i = 0; i < uids_uncached->len; i++) {
g_hash_table_remove (uids_hash, uids_uncached->pdata[i]);
@@ -2298,10 +2296,10 @@ void
camel_folder_summary_add_preview (CamelFolderSummary *summary,
CamelMessageInfo *info)
{
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
g_hash_table_insert (summary->priv->preview_updates, (gchar *) info->uid, ((CamelMessageInfoBase *)
info)->preview);
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/**
@@ -2328,9 +2326,9 @@ camel_folder_summary_prepare_fetch_all (CamelFolderSummary *summary,
known = camel_folder_summary_count (summary);
if (known - loaded > 50) {
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
cfs_reload_from_db (summary, error);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/* update also cache load time, even when not loaded anything */
@@ -2357,7 +2355,7 @@ camel_folder_summary_load_from_db (CamelFolderSummary *summary,
if (is_in_memory_summary (summary))
return TRUE;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
camel_folder_summary_save_to_db (summary, NULL);
/* struct _db_pass_data data; */
@@ -2366,7 +2364,7 @@ camel_folder_summary_load_from_db (CamelFolderSummary *summary,
full_name = camel_folder_get_full_name (summary->priv->folder);
parent_store = camel_folder_get_parent_store (summary->priv->folder);
if (!camel_folder_summary_header_load_from_db (summary, parent_store, full_name, error)) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -2385,7 +2383,7 @@ camel_folder_summary_load_from_db (CamelFolderSummary *summary,
} else if (local_error != NULL)
g_propagate_error (error, local_error);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return ret == 0;
}
@@ -2503,14 +2501,14 @@ camel_read_mir_callback (gpointer ref,
mir = g_new0 (CamelMIRecord , 1);
mir_from_cols (mir, summary, &data->columns_hash, ncol, cols, name);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (!mir->uid || g_hash_table_lookup (summary->priv->loaded_infos, mir->uid)) {
/* Unlock and better return */
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
camel_db_camel_mir_free (mir);
return ret;
}
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
info = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->message_info_from_db (summary, mir);
@@ -2640,14 +2638,14 @@ save_message_infos_to_db (CamelFolderSummary *summary,
if (camel_db_prepare_message_info_table (cdb, full_name, error) != 0)
return -1;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
/* Push MessageInfo-es */
camel_db_begin_transaction (cdb, NULL);
g_hash_table_foreach (summary->priv->loaded_infos, save_to_db_cb, error);
camel_db_end_transaction (cdb, NULL);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
cfs_schedule_info_release_timer (summary);
return 0;
@@ -2691,7 +2689,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
parent_store = camel_folder_get_parent_store (summary->priv->folder);
cdb = parent_store->cdb_w;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
d (printf ("\ncamel_folder_summary_save_to_db called \n"));
if (summary->priv->need_preview && g_hash_table_size (summary->priv->preview_updates)) {
@@ -2706,7 +2704,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
count = cfs_count_dirty (summary);
if (!count) {
gboolean res = camel_folder_summary_header_save_to_db (summary, error);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -2714,7 +2712,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
if (ret != 0) {
/* Failed, so lets reset the flag */
summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -2735,7 +2733,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
ret = save_message_infos_to_db (summary, error);
if (ret != 0) {
summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
}
@@ -2743,7 +2741,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
if (!record) {
summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -2756,12 +2754,12 @@ camel_folder_summary_save_to_db (CamelFolderSummary *summary,
if (ret != 0) {
camel_db_abort_transaction (cdb, NULL);
summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
camel_db_end_transaction (cdb, NULL);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return ret == 0;
}
@@ -2785,13 +2783,13 @@ camel_folder_summary_header_save_to_db (CamelFolderSummary *summary,
parent_store = camel_folder_get_parent_store (summary->priv->folder);
cdb = parent_store->cdb_w;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
d (printf ("\ncamel_folder_summary_header_save_to_db called \n"));
record = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_to_db (summary, error);
if (!record) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -2803,12 +2801,12 @@ camel_folder_summary_header_save_to_db (CamelFolderSummary *summary,
if (ret != 0) {
camel_db_abort_transaction (cdb, NULL);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
camel_db_end_transaction (cdb, NULL);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return ret == 0;
}
@@ -2833,7 +2831,7 @@ camel_folder_summary_header_load_from_db (CamelFolderSummary *summary,
if (is_in_memory_summary (summary))
return TRUE;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
camel_folder_summary_save_to_db (summary, NULL);
cdb = store->cdb_r;
@@ -2843,7 +2841,7 @@ camel_folder_summary_header_load_from_db (CamelFolderSummary *summary,
ret = CAMEL_FOLDER_SUMMARY_GET_CLASS (summary)->summary_header_from_db (summary, record);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
g_free (record->folder_name);
g_free (record->bdata);
@@ -2866,10 +2864,10 @@ summary_assign_uid (CamelFolderSummary *summary,
uid = info->uid = (gchar *) camel_pstring_add (camel_folder_summary_next_uid_string
(summary), TRUE);
}
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
while ((mi = g_hash_table_lookup (summary->priv->loaded_infos, uid))) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
if (mi == info)
return FALSE;
@@ -2880,10 +2878,10 @@ summary_assign_uid (CamelFolderSummary *summary,
uid = info->uid = camel_pstring_add (camel_folder_summary_next_uid_string (summary), TRUE);
camel_message_info_set_flags (info, CAMEL_MESSAGE_FOLDER_FLAGGED,
CAMEL_MESSAGE_FOLDER_FLAGGED);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
}
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return TRUE;
}
@@ -2912,9 +2910,9 @@ camel_folder_summary_add (CamelFolderSummary *summary,
if (info == NULL)
return;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (!summary_assign_uid (summary, info)) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return;
}
@@ -2933,7 +2931,7 @@ camel_folder_summary_add (CamelFolderSummary *summary,
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/**
@@ -2951,7 +2949,7 @@ camel_folder_summary_insert (CamelFolderSummary *summary,
if (info == NULL)
return;
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (!load) {
CamelMessageInfoBase *base_info = (CamelMessageInfoBase *) info;
@@ -2971,7 +2969,7 @@ camel_folder_summary_insert (CamelFolderSummary *summary,
/* Summary always holds a ref for the loaded infos */
g_hash_table_insert (summary->priv->loaded_infos, (gchar *) camel_message_info_uid (info), info);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/**
@@ -3161,9 +3159,9 @@ camel_folder_summary_content_info_free (CamelFolderSummary *summary,
void
camel_folder_summary_touch (CamelFolderSummary *summary)
{
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
summary->flags |= CAMEL_FOLDER_SUMMARY_DIRTY;
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
/**
@@ -3184,9 +3182,9 @@ camel_folder_summary_clear (CamelFolderSummary *summary,
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (camel_folder_summary_count (summary) == 0) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return TRUE;
}
@@ -3222,7 +3220,7 @@ camel_folder_summary_clear (CamelFolderSummary *summary,
g_object_notify (summary_object, "visible-count");
g_object_thaw_notify (summary_object);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -3273,9 +3271,9 @@ camel_folder_summary_remove_uid (CamelFolderSummary *summary,
g_return_val_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary), FALSE);
g_return_val_if_fail (uid != NULL, FALSE);
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (!g_hash_table_lookup_extended (summary->priv->uids, uid, &ptr_uid, &ptr_flags)) {
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return FALSE;
}
@@ -3295,7 +3293,7 @@ camel_folder_summary_remove_uid (CamelFolderSummary *summary,
camel_pstring_free (uid_copy);
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
return res;
}
@@ -3324,7 +3322,7 @@ camel_folder_summary_remove_uids (CamelFolderSummary *summary,
g_return_val_if_fail (uids != NULL, FALSE);
g_object_freeze_notify (G_OBJECT (summary));
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
for (l = g_list_first (uids); l; l = g_list_next (l)) {
gpointer ptr_uid = NULL, ptr_flags = NULL;
@@ -3352,7 +3350,7 @@ camel_folder_summary_remove_uids (CamelFolderSummary *summary,
}
camel_folder_summary_touch (summary);
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
g_object_thaw_notify (G_OBJECT (summary));
return res;
@@ -3644,11 +3642,11 @@ message_info_free (CamelFolderSummary *summary,
if (mi->uid) {
if (summary) {
- camel_folder_summary_lock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (summary);
if (g_hash_table_lookup (summary->priv->loaded_infos, mi->uid) == mi) {
g_hash_table_remove (summary->priv->loaded_infos, mi->uid);
}
- camel_folder_summary_unlock (summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (summary);
}
camel_pstring_free (mi->uid);
}
@@ -4770,49 +4768,33 @@ camel_folder_summary_guess_content_info (CamelMessageInfo *mi,
/**
* camel_folder_summary_lock:
* @summary: a #CamelFolderSummary
- * @lock: lock type to lock
*
- * Locks @summary's @lock. Unlock it with camel_folder_summary_unlock().
+ * Locks @summary. Unlock it with camel_folder_summary_unlock().
*
* Since: 2.32
**/
void
-camel_folder_summary_lock (CamelFolderSummary *summary,
- CamelFolderSummaryLock lock)
+camel_folder_summary_lock (CamelFolderSummary *summary)
{
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
- switch (lock) {
- case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
- g_rec_mutex_lock (&summary->priv->summary_lock);
- break;
- default:
- g_return_if_reached ();
- }
+ g_rec_mutex_lock (&summary->priv->summary_lock);
}
/**
* camel_folder_summary_unlock:
* @summary: a #CamelFolderSummary
- * @lock: lock type to unlock
*
- * Unlocks @summary's @lock, previously locked with camel_folder_summary_lock().
+ * Unlocks @summary, previously locked with camel_folder_summary_lock().
*
* Since: 2.32
**/
void
-camel_folder_summary_unlock (CamelFolderSummary *summary,
- CamelFolderSummaryLock lock)
+camel_folder_summary_unlock (CamelFolderSummary *summary)
{
g_return_if_fail (CAMEL_IS_FOLDER_SUMMARY (summary));
- switch (lock) {
- case CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK:
- g_rec_mutex_unlock (&summary->priv->summary_lock);
- break;
- default:
- g_return_if_reached ();
- }
+ g_rec_mutex_unlock (&summary->priv->summary_lock);
}
gint
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index 58129c0..a98a278 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -504,10 +504,8 @@ void camel_folder_summary_prepare_fetch_all
GError **error);
/* summary locking */
-void camel_folder_summary_lock (CamelFolderSummary *summary,
- CamelFolderSummaryLock lock);
-void camel_folder_summary_unlock (CamelFolderSummary *summary,
- CamelFolderSummaryLock lock);
+void camel_folder_summary_lock (CamelFolderSummary *summary);
+void camel_folder_summary_unlock (CamelFolderSummary *summary);
/* message flag operations */
gboolean camel_flag_get (CamelFlag **list,
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index b825112..ec70318 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -422,7 +422,7 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (summary), NULL);
g_return_val_if_fail (CAMEL_IS_FOLDER (subfolder), NULL);
- camel_folder_summary_lock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (&summary->summary);
/* uses direct hash, because strings are supposed to be from the string pool */
known_uids = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify)
camel_pstring_free, NULL);
@@ -432,7 +432,7 @@ camel_vee_summary_get_uids_for_subfolder (CamelVeeSummary *summary,
g_hash_table_foreach (vuids, get_uids_for_subfolder, known_uids);
}
- camel_folder_summary_unlock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&summary->summary);
return known_uids;
}
@@ -451,7 +451,7 @@ camel_vee_summary_add (CamelVeeSummary *s,
g_return_val_if_fail (CAMEL_IS_VEE_SUMMARY (s), NULL);
g_return_val_if_fail (CAMEL_IS_VEE_MESSAGE_INFO_DATA (mi_data), NULL);
- camel_folder_summary_lock (&s->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (&s->summary);
sf_data = camel_vee_message_info_data_get_subfolder_data (mi_data);
vuid = camel_vee_message_info_data_get_vee_message_uid (mi_data);
@@ -464,7 +464,7 @@ camel_vee_summary_add (CamelVeeSummary *s,
if (!vmi->orig_summary)
vmi->orig_summary = g_object_ref (orig_folder->summary);
- camel_folder_summary_unlock (&s->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&s->summary);
return vmi;
}
@@ -485,7 +485,7 @@ camel_vee_summary_add (CamelVeeSummary *s,
}
camel_folder_summary_insert (&s->summary, (CamelMessageInfo *) vmi, FALSE);
- camel_folder_summary_unlock (&s->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&s->summary);
return vmi;
}
@@ -509,7 +509,7 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
g_return_if_fail (vuid != NULL);
g_return_if_fail (subfolder != NULL);
- camel_folder_summary_lock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (&summary->summary);
vuids = g_hash_table_lookup (summary->priv->vuids_by_subfolder, subfolder);
if (vuids) {
@@ -529,7 +529,7 @@ camel_vee_summary_remove (CamelVeeSummary *summary,
camel_message_info_unref (mi);
}
- camel_folder_summary_unlock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&summary->summary);
}
/**
@@ -552,16 +552,16 @@ camel_vee_summary_replace_flags (CamelVeeSummary *summary,
g_return_if_fail (CAMEL_IS_VEE_SUMMARY (summary));
g_return_if_fail (uid != NULL);
- camel_folder_summary_lock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (&summary->summary);
mi = camel_folder_summary_get (&summary->summary, uid);
if (!mi) {
- camel_folder_summary_unlock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&summary->summary);
return;
}
camel_folder_summary_replace_flags (&summary->summary, mi);
camel_message_info_unref (mi);
- camel_folder_summary_unlock (&summary->summary, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (&summary->summary);
}
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index e54390c..8f4f361 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -449,11 +449,11 @@ summary_update (CamelLocalSummary *cls,
camel_operation_push_message (cancellable, _("Storing folder"));
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
fd = g_open (cls->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
if (fd == -1) {
d (printf ("%s failed to open: %s\n", cls->folder_path, g_strerror (errno)));
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -559,7 +559,7 @@ summary_update (CamelLocalSummary *cls,
}
camel_operation_pop_message (cancellable);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return ok;
}
@@ -578,12 +578,12 @@ mbox_summary_check (CamelLocalSummary *cls,
d (printf ("Checking summary\n"));
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
/* check if the summary is up-to-date */
if (g_stat (cls->folder_path, &st) == -1) {
camel_folder_summary_clear (s, NULL);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -640,7 +640,7 @@ mbox_summary_check (CamelLocalSummary *cls,
}
}
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return ret;
}
@@ -663,7 +663,7 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
d (printf ("performing full summary/sync\n"));
camel_operation_push_message (cancellable, _("Storing folder"));
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
/* preserve attributes as set on the file previously */
if (g_stat (cls->folder_path, &st) == 0)
@@ -671,7 +671,7 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
fd = g_open (cls->folder_path, O_LARGEFILE | O_RDONLY | O_BINARY, 0);
if (fd == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -744,7 +744,7 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
}
camel_operation_pop_message (cancellable);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return 0;
error:
@@ -757,7 +757,7 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
g_unlink (tmpname);
camel_operation_pop_message (cancellable);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
@@ -811,11 +811,11 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
d (printf ("Performing quick summary sync\n"));
camel_operation_push_message (cancellable, _("Storing folder"));
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
fd = g_open (cls->folder_path, O_LARGEFILE | O_RDWR | O_BINARY, 0);
if (fd == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -829,7 +829,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
/* need to dup since mime parser closes its fd once it is finalized */
pfd = dup (fd);
if (pfd == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -947,7 +947,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
g_object_unref (mp);
camel_operation_pop_message (cancellable);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return 0;
error:
@@ -961,7 +961,7 @@ mbox_summary_sync_quick (CamelMboxSummary *mbs,
camel_message_info_unref (info);
camel_operation_pop_message (cancellable);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
@@ -983,11 +983,11 @@ mbox_summary_sync (CamelLocalSummary *cls,
gint ret;
GPtrArray *summary = NULL;
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
/* first, sync ourselves up, just to make sure */
if (camel_local_summary_check (cls, changeinfo, cancellable, error) == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
@@ -1015,7 +1015,7 @@ mbox_summary_sync (CamelLocalSummary *cls,
guint32 dcount =0;
if (camel_db_count_deleted_message_info (parent_store->cdb_w, full_name, &dcount, error) ==
-1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
if (dcount)
@@ -1039,7 +1039,7 @@ mbox_summary_sync (CamelLocalSummary *cls,
ret = CAMEL_MBOX_SUMMARY_GET_CLASS (cls)->sync_full (
mbs, expunge, changeinfo, cancellable, error);
if (ret == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
@@ -1048,7 +1048,7 @@ mbox_summary_sync (CamelLocalSummary *cls,
error, G_IO_ERROR,
g_io_error_from_errno (errno),
_("Unknown error: %s"), g_strerror (errno));
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
@@ -1059,7 +1059,7 @@ mbox_summary_sync (CamelLocalSummary *cls,
}
ret = CAMEL_LOCAL_SUMMARY_CLASS (camel_mbox_summary_parent_class)->sync (cls, expunge, changeinfo,
cancellable, error);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return ret;
}
@@ -1093,12 +1093,12 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
d (printf ("performing full summary/sync\n"));
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_lock (s);
/* need to dup this because the mime-parser owns the fd after we give it to it */
fd = dup (fd);
if (fd == -1) {
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
g_set_error (
error, G_IO_ERROR,
g_io_error_from_errno (errno),
@@ -1292,7 +1292,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
if (touched)
camel_folder_summary_header_save_to_db (s, NULL);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return 0;
error:
@@ -1303,7 +1303,7 @@ camel_mbox_summary_sync_mbox (CamelMboxSummary *cls,
camel_message_info_unref (info);
camel_folder_summary_free_array (known_uids);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
+ camel_folder_summary_unlock (s);
return -1;
}
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 363a841..a0aeb5f 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -214,7 +214,6 @@ mh_summary_check (CamelLocalSummary *cls,
struct dirent *d;
gchar *p, c;
CamelMessageInfo *info;
- CamelFolderSummary *s = (CamelFolderSummary *) cls;
GHashTable *left;
gint i;
gboolean forceindex;
@@ -288,10 +287,6 @@ mh_summary_check (CamelLocalSummary *cls,
g_hash_table_foreach (left, (GHFunc) remove_summary, cls);
g_hash_table_destroy (left);
- /* sort the summary based on message number (uid), since the directory order is not useful */
- camel_folder_summary_lock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
- camel_folder_summary_unlock (s, CAMEL_FOLDER_SUMMARY_SUMMARY_LOCK);
-
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]