[evolution] MailFolderCache: Remove unnecessary "stores" checks.



commit 99d026acbef48f4e7a574ffe2382bb54b380d4a2
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 15 15:18:10 2013 -0400

    MailFolderCache: Remove unnecessary "stores" checks.
    
    The "stores" hash table is created on instance init and destroyed with
    the cache itself.  It is never NULL during MailFolderCache's lifetime.

 libemail-engine/mail-folder-cache.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c
index 6f469dd..b243376 100644
--- a/libemail-engine/mail-folder-cache.c
+++ b/libemail-engine/mail-folder-cache.c
@@ -498,8 +498,7 @@ folder_changed_cb (CamelFolder *folder,
                        GINT_TO_POINTER (new_latest_received));
 
        g_rec_mutex_lock (&cache->priv->stores_mutex);
-       if (cache->priv->stores != NULL
-           && (si = g_hash_table_lookup (cache->priv->stores, parent_store)) != NULL
+       if ((si = g_hash_table_lookup (cache->priv->stores, parent_store)) != NULL
            && (mfi = g_hash_table_lookup (si->folders, full_name)) != NULL
            && mfi->folder == folder) {
                update_1folder (cache, mfi, new, uid, sender, subject, NULL);
@@ -1570,8 +1569,7 @@ mail_folder_cache_note_folder (MailFolderCache *cache,
        parent_store = camel_folder_get_parent_store (folder);
 
        g_rec_mutex_lock (&cache->priv->stores_mutex);
-       if (cache->priv->stores == NULL
-           || (si = g_hash_table_lookup (cache->priv->stores, parent_store)) == NULL
+       if ((si = g_hash_table_lookup (cache->priv->stores, parent_store)) == NULL
            || (mfi = g_hash_table_lookup (si->folders, full_name)) == NULL) {
                w (g_warning ("Noting folder before store initialised"));
                g_rec_mutex_unlock (&cache->priv->stores_mutex);
@@ -1623,9 +1621,6 @@ mail_folder_cache_has_folder_info (MailFolderCache *cache,
        g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE);
        g_return_val_if_fail (folder_name != NULL, FALSE);
 
-       if (cache->priv->stores == NULL)
-               return FALSE;
-
        g_rec_mutex_lock (&cache->priv->stores_mutex);
        si = g_hash_table_lookup (cache->priv->stores, store);
        if (si != NULL)
@@ -1663,9 +1658,6 @@ mail_folder_cache_ref_folder (MailFolderCache *cache,
        g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
        g_return_val_if_fail (folder_name != NULL, NULL);
 
-       if (cache->priv->stores == NULL)
-               return NULL;
-
        g_rec_mutex_lock (&cache->priv->stores_mutex);
        si = g_hash_table_lookup (cache->priv->stores, store);
        if (si != NULL) {
@@ -1706,9 +1698,6 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *cache,
        g_return_val_if_fail (folder_name != NULL, FALSE);
        g_return_val_if_fail (flags != NULL, FALSE);
 
-       if (cache->priv->stores == NULL)
-               return FALSE;
-
        g_rec_mutex_lock (&cache->priv->stores_mutex);
        si = g_hash_table_lookup (cache->priv->stores, store);
        if (si != NULL) {
@@ -1772,9 +1761,6 @@ mail_folder_cache_service_removed (MailFolderCache *cache,
        g_return_if_fail (MAIL_IS_FOLDER_CACHE (cache));
        g_return_if_fail (CAMEL_IS_SERVICE (service));
 
-       if (cache->priv->stores == NULL)
-               return;
-
        g_rec_mutex_lock (&cache->priv->stores_mutex);
 
        si = g_hash_table_lookup (cache->priv->stores, service);


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