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



commit a4ff75f5f043bb1a316a7d6c089145417b04aebc
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Sep 22 08:54:12 2013 -0400

    camel_store_(un)lock: Remove 'lock' enum argument.
    
    CAMEL_STORE_FOLDER_LOCK is the only option.

 camel/camel-store.c        |   52 +++++++++++++++----------------------------
 camel/camel-store.h        |    6 +---
 camel/camel-subscribable.c |   24 +++++---------------
 3 files changed, 26 insertions(+), 56 deletions(-)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 057ca78..4da69e5 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1912,49 +1912,33 @@ camel_store_can_refresh_folder (CamelStore *store,
 /**
  * camel_store_lock:
  * @store: a #CamelStore
- * @lock: lock type to lock
  *
- * Locks @store's @lock. Unlock it with camel_store_unlock().
+ * Locks @store. Unlock it with camel_store_unlock().
  *
  * Since: 2.32
  **/
 void
-camel_store_lock (CamelStore *store,
-                  CamelStoreLock lock)
+camel_store_lock (CamelStore *store)
 {
        g_return_if_fail (CAMEL_IS_STORE (store));
 
-       switch (lock) {
-               case CAMEL_STORE_FOLDER_LOCK:
-                       g_rec_mutex_lock (&store->priv->folder_lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
+       g_rec_mutex_lock (&store->priv->folder_lock);
 }
 
 /**
  * camel_store_unlock:
  * @store: a #CamelStore
- * @lock: lock type to unlock
  *
- * Unlocks @store's @lock, previously locked with camel_store_lock().
+ * Unlocks @store, previously locked with camel_store_lock().
  *
  * Since: 2.32
  **/
 void
-camel_store_unlock (CamelStore *store,
-                    CamelStoreLock lock)
+camel_store_unlock (CamelStore *store)
 {
        g_return_if_fail (CAMEL_IS_STORE (store));
 
-       switch (lock) {
-               case CAMEL_STORE_FOLDER_LOCK:
-                       g_rec_mutex_unlock (&store->priv->folder_lock);
-                       break;
-               default:
-                       g_return_if_reached ();
-       }
+       g_rec_mutex_unlock (&store->priv->folder_lock);
 }
 
 /**
@@ -2449,11 +2433,11 @@ camel_store_get_inbox_folder_sync (CamelStore *store,
        class = CAMEL_STORE_GET_CLASS (store);
        g_return_val_if_fail (class->get_inbox_folder_sync != NULL, NULL);
 
-       camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (store);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+               camel_store_unlock (store);
                return NULL;
        }
 
@@ -2461,7 +2445,7 @@ camel_store_get_inbox_folder_sync (CamelStore *store,
        CAMEL_CHECK_GERROR (
                store, get_inbox_folder_sync, folder != NULL, error);
 
-       camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (store);
 
        return folder;
 }
@@ -2776,11 +2760,11 @@ camel_store_create_folder_sync (CamelStore *store,
                return NULL;
        }
 
-       camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (store);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+               camel_store_unlock (store);
                return NULL;
        }
 
@@ -2793,7 +2777,7 @@ camel_store_create_folder_sync (CamelStore *store,
 
        camel_operation_pop_message (cancellable);
 
-       camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (store);
 
        return fi;
 }
@@ -2908,11 +2892,11 @@ camel_store_delete_folder_sync (CamelStore *store,
                return FALSE;
        }
 
-       camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (store);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+               camel_store_unlock (store);
                return FALSE;
        }
 
@@ -2932,7 +2916,7 @@ camel_store_delete_folder_sync (CamelStore *store,
        else
                g_propagate_error (error, local_error);
 
-       camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (store);
 
        return success;
 }
@@ -3055,11 +3039,11 @@ camel_store_rename_folder_sync (CamelStore *store,
        old_name = g_strdup (old_namein);
        oldlen = strlen (old_name);
 
-       camel_store_lock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (store);
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
-               camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+               camel_store_unlock (store);
                return FALSE;
        }
 
@@ -3138,7 +3122,7 @@ camel_store_rename_folder_sync (CamelStore *store,
                }
        }
 
-       camel_store_unlock (store, CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (store);
 
        g_ptr_array_free (folders, TRUE);
        g_free (old_name);
diff --git a/camel/camel-store.h b/camel/camel-store.h
index e5ee40f..f51059d 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -343,10 +343,8 @@ CamelFolderInfo *
 gboolean       camel_store_can_refresh_folder  (CamelStore *store,
                                                 CamelFolderInfo *info,
                                                 GError **error);
-void           camel_store_lock                (CamelStore *store,
-                                                CamelStoreLock lock);
-void           camel_store_unlock              (CamelStore *store,
-                                                CamelStoreLock lock);
+void           camel_store_lock                (CamelStore *store);
+void           camel_store_unlock              (CamelStore *store);
 
 CamelFolder *  camel_store_get_folder_sync     (CamelStore *store,
                                                 const gchar *folder_name,
diff --git a/camel/camel-subscribable.c b/camel/camel-subscribable.c
index 9675e15..b46dbbe 100644
--- a/camel/camel-subscribable.c
+++ b/camel/camel-subscribable.c
@@ -333,16 +333,12 @@ camel_subscribable_folder_is_subscribed (CamelSubscribable *subscribable,
        interface = CAMEL_SUBSCRIBABLE_GET_INTERFACE (subscribable);
        g_return_val_if_fail (interface->folder_is_subscribed != NULL, FALSE);
 
-       camel_store_lock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (CAMEL_STORE (subscribable));
 
        is_subscribed = interface->folder_is_subscribed (
                subscribable, folder_name);
 
-       camel_store_unlock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (CAMEL_STORE (subscribable));
 
        return is_subscribed;
 }
@@ -376,9 +372,7 @@ camel_subscribable_subscribe_folder_sync (CamelSubscribable *subscribable,
        interface = CAMEL_SUBSCRIBABLE_GET_INTERFACE (subscribable);
        g_return_val_if_fail (interface->subscribe_folder_sync != NULL, FALSE);
 
-       camel_store_lock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (CAMEL_STORE (subscribable));
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
@@ -403,9 +397,7 @@ camel_subscribable_subscribe_folder_sync (CamelSubscribable *subscribable,
        camel_operation_pop_message (cancellable);
 
 exit:
-       camel_store_unlock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (CAMEL_STORE (subscribable));
 
        return success;
 }
@@ -508,9 +500,7 @@ camel_subscribable_unsubscribe_folder_sync (CamelSubscribable *subscribable,
        g_return_val_if_fail (
                interface->unsubscribe_folder_sync != NULL, FALSE);
 
-       camel_store_lock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_lock (CAMEL_STORE (subscribable));
 
        /* Check for cancellation after locking. */
        if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
@@ -539,9 +529,7 @@ camel_subscribable_unsubscribe_folder_sync (CamelSubscribable *subscribable,
        camel_operation_pop_message (cancellable);
 
 exit:
-       camel_store_unlock (
-               CAMEL_STORE (subscribable),
-               CAMEL_STORE_FOLDER_LOCK);
+       camel_store_unlock (CAMEL_STORE (subscribable));
 
        return success;
 }


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