[evolution-data-server] camel_folder_(un)lock: Remove 'lock' enum argument.



commit f4597ea50ca281ccd77089e6050f617de4554da5
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Sep 22 09:35:48 2013 -0400

    camel_folder_(un)lock: Remove 'lock' enum argument.
    
    CAMEL_FOLDER_REC_LOCK is the only option.

 camel/camel-folder-summary.c |    4 +-
 camel/camel-folder.c         |   86 +++++++++++++++++-------------------------
 camel/camel-folder.h         |    6 +--
 camel/camel-store.c          |    6 +-
 4 files changed, 42 insertions(+), 60 deletions(-)
---
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 29c565a..df5fdcf 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -2226,13 +2226,13 @@ preview_update (CamelSession *session,
                g_hash_table_remove (uids_hash, uids_uncached->pdata[i]);
        }
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
        if (!is_in_memory)
                camel_db_begin_transaction (parent_store->cdb_w, NULL);
        g_hash_table_foreach (uids_hash, (GHFunc) msg_update_preview, folder);
        if (!is_in_memory)
                camel_db_end_transaction (parent_store->cdb_w, NULL);
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
        camel_folder_free_uids (folder, uids_uncached);
        g_hash_table_destroy (uids_hash);
 }
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index ce5e2a5..acc0bc3 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -2976,9 +2976,9 @@ camel_folder_delete (CamelFolder *folder)
        class = CAMEL_FOLDER_GET_CLASS (folder);
        g_return_if_fail (class->delete_ != NULL);
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
        if (folder->folder_flags & CAMEL_FOLDER_HAS_BEEN_DELETED) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return;
        }
 
@@ -2986,7 +2986,7 @@ camel_folder_delete (CamelFolder *folder)
 
        class->delete_ (folder);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        /* Delete the references of the folder from the DB.*/
        full_name = camel_folder_get_full_name (folder);
@@ -3343,51 +3343,35 @@ camel_folder_free_deep (CamelFolder *folder,
 /**
  * camel_folder_lock:
  * @folder: a #CamelFolder
- * @lock: lock type to lock
  *
- * Locks @folder's @lock. Unlock it with camel_folder_unlock().
+ * Locks @folder. Unlock it with camel_folder_unlock().
  *
  * Since: 2.32
  **/
 void
-camel_folder_lock (CamelFolder *folder,
-                   CamelFolderLock lock)
+camel_folder_lock (CamelFolder *folder)
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
-       switch (lock) {
-               case CAMEL_FOLDER_REC_LOCK:
-                       if (folder->priv->skip_folder_lock == FALSE)
-                               g_rec_mutex_lock (&folder->priv->lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
+       if (folder->priv->skip_folder_lock == FALSE)
+               g_rec_mutex_lock (&folder->priv->lock);
 }
 
 /**
  * camel_folder_unlock:
  * @folder: a #CamelFolder
- * @lock: lock type to unlock
  *
- * Unlocks @folder's @lock, previously locked with camel_folder_lock().
+ * Unlocks @folder, previously locked with camel_folder_lock().
  *
  * Since: 2.32
  **/
 void
-camel_folder_unlock (CamelFolder *folder,
-                     CamelFolderLock lock)
+camel_folder_unlock (CamelFolder *folder)
 {
        g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
-       switch (lock) {
-               case CAMEL_FOLDER_REC_LOCK:
-                       if (folder->priv->skip_folder_lock == FALSE)
-                               g_rec_mutex_unlock (&folder->priv->lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
+       if (folder->priv->skip_folder_lock == FALSE)
+               g_rec_mutex_unlock (&folder->priv->lock);
 }
 
 /**
@@ -3433,11 +3417,11 @@ camel_folder_append_message_sync (CamelFolder *folder,
        if (!success)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -3445,7 +3429,7 @@ camel_folder_append_message_sync (CamelFolder *folder,
                folder, message, info, appended_uid, cancellable, error);
        CAMEL_CHECK_GERROR (folder, append_message_sync, success, error);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -3559,11 +3543,11 @@ camel_folder_expunge_sync (CamelFolder *folder,
        if (!success)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -3578,7 +3562,7 @@ camel_folder_expunge_sync (CamelFolder *folder,
 
        camel_operation_pop_message (cancellable);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -3679,11 +3663,11 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
        if (class->fetch_messages_sync == NULL)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -3691,7 +3675,7 @@ camel_folder_fetch_messages_sync (CamelFolder *folder,
                folder, type, limit, cancellable, error);
        CAMEL_CHECK_GERROR (folder, fetch_messages_sync, success, error);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -3818,11 +3802,11 @@ camel_folder_get_message_sync (CamelFolder *folder,
                if (!folder_maybe_connect_sync (folder, cancellable, error))
                        return NULL;
 
-               camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_lock (folder);
 
                /* Check for cancellation after locking. */
                if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-                       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+                       camel_folder_unlock (folder);
                        camel_operation_pop_message (cancellable);
                        return NULL;
                }
@@ -3832,7 +3816,7 @@ camel_folder_get_message_sync (CamelFolder *folder,
                CAMEL_CHECK_GERROR (
                        folder, get_message_sync, message != NULL, error);
 
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
        }
 
        if (message && camel_mime_message_get_source (message) == NULL) {
@@ -4067,11 +4051,11 @@ camel_folder_purge_message_cache_sync (CamelFolder *folder,
        if (class->purge_message_cache_sync == NULL)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -4079,7 +4063,7 @@ camel_folder_purge_message_cache_sync (CamelFolder *folder,
                folder, start_uid, end_uid, cancellable, error);
        CAMEL_CHECK_GERROR (folder, purge_message_cache_sync, success, error);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -4186,11 +4170,11 @@ camel_folder_refresh_info_sync (CamelFolder *folder,
        if (!success)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -4203,7 +4187,7 @@ camel_folder_refresh_info_sync (CamelFolder *folder,
 
        camel_operation_pop_message (cancellable);
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -4305,11 +4289,11 @@ camel_folder_synchronize_sync (CamelFolder *folder,
        if (!success)
                return FALSE;
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -4319,7 +4303,7 @@ camel_folder_synchronize_sync (CamelFolder *folder,
                CAMEL_CHECK_GERROR (folder, synchronize_sync, success, error);
        }
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
@@ -4419,11 +4403,11 @@ camel_folder_synchronize_message_sync (CamelFolder *folder,
        class = CAMEL_FOLDER_GET_CLASS (folder);
        g_return_val_if_fail (class->get_message_sync != NULL, FALSE);
 
-       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_lock (folder);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+               camel_folder_unlock (folder);
                return FALSE;
        }
 
@@ -4447,7 +4431,7 @@ camel_folder_synchronize_message_sync (CamelFolder *folder,
                }
        }
 
-       camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+       camel_folder_unlock (folder);
 
        return success;
 }
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 1e25b80..b5211a7 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -513,10 +513,8 @@ void               camel_folder_free_deep          (CamelFolder *folder,
 gchar *                camel_folder_get_filename       (CamelFolder *folder,
                                                 const gchar *uid,
                                                 GError **error);
-void           camel_folder_lock               (CamelFolder *folder,
-                                                CamelFolderLock lock);
-void           camel_folder_unlock             (CamelFolder *folder,
-                                                CamelFolderLock lock);
+void           camel_folder_lock               (CamelFolder *folder);
+void           camel_folder_unlock             (CamelFolder *folder);
 
 gboolean       camel_folder_append_message_sync
                                                (CamelFolder *folder,
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 4da69e5..0bb515a 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -3063,7 +3063,7 @@ camel_store_rename_folder_sync (CamelStore *store,
                    || ((namelen > oldlen)
                        && strncmp (full_name, old_name, oldlen) == 0
                        && full_name[oldlen] == '/')) {
-                       camel_folder_lock (folder, CAMEL_FOLDER_REC_LOCK);
+                       camel_folder_lock (folder);
                } else {
                        g_ptr_array_remove_index_fast (folders, i);
                        i--;
@@ -3096,7 +3096,7 @@ camel_store_rename_folder_sync (CamelStore *store,
                                camel_folder_rename (folder, new);
                                g_free (new);
 
-                               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+                               camel_folder_unlock (folder);
                                g_object_unref (folder);
                        }
 
@@ -3116,7 +3116,7 @@ camel_store_rename_folder_sync (CamelStore *store,
                        /* Failed, just unlock our folders for re-use */
                        for (i = 0; i < folders->len; i++) {
                                folder = folders->pdata[i];
-                               camel_folder_unlock (folder, CAMEL_FOLDER_REC_LOCK);
+                               camel_folder_unlock (folder);
                                g_object_unref (folder);
                        }
                }


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