[evolution-data-server] Remove camel_folder_free_message_info().



commit 88b4f9827861c6a2ba40d9599ad2c1c24364d86d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Sep 23 08:36:59 2013 -0400

    Remove camel_folder_free_message_info().
    
    Use camel_message_info_unref() instead.

 camel/camel-disco-diary.c               |    4 ++-
 camel/camel-filter-driver.c             |    2 +-
 camel/camel-folder-thread.c             |   17 ++++++++----
 camel/camel-folder.c                    |   39 ++----------------------------
 camel/camel-folder.h                    |    4 ---
 camel/camel-vee-folder.c                |    2 +-
 camel/camel-vtrash-folder.c             |    4 +-
 camel/tests/lib/folders.c               |   12 ++++----
 docs/reference/camel/camel-sections.txt |    1 -
 9 files changed, 27 insertions(+), 58 deletions(-)
---
diff --git a/camel/camel-disco-diary.c b/camel/camel-disco-diary.c
index fc14c97..6e6cffc 100644
--- a/camel/camel-disco-diary.c
+++ b/camel/camel-disco-diary.c
@@ -376,12 +376,14 @@ camel_disco_diary_replay (CamelDiscoDiary *diary,
                                g_free (uid);
                                continue;
                        }
+
                        info = camel_folder_get_message_info (folder, uid);
 
                        camel_folder_append_message_sync (
                                folder, message, info, &ret_uid,
                                cancellable, &local_error);
-                       camel_folder_free_message_info (folder, info);
+
+                       camel_message_info_unref (info);
 
                        if (ret_uid) {
                                camel_disco_diary_uidmap_add (diary, uid, ret_uid);
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index caa4917..0f6598a 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -1548,7 +1548,7 @@ camel_filter_driver_filter_folder (CamelFilterDriver *driver,
                        store_uid, store_uid, cancellable, &local_error);
 
                if (camel_folder_has_summary_capability (folder))
-                       camel_folder_free_message_info (folder, info);
+                       camel_message_info_unref (info);
 
                if (local_error != NULL || status == -1) {
                        report_status (
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index 6c18a7b..c4f487a 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -672,13 +672,18 @@ add_present_rec (CamelFolderThread *thread,
                  CamelFolderThreadNode *node)
 {
        while (node) {
-               const gchar *uid = camel_message_info_uid (node->message);
+               CamelMessageInfo *info;
+               const gchar *uid;
+
+               /* XXX Casting away const. */
+               info = (CamelMessageInfo *) node->message;
+               uid = camel_message_info_uid (info);
 
-               if (g_hash_table_lookup (have, (gchar *) uid)) {
-                       g_hash_table_remove (have, (gchar *) camel_message_info_uid (node->message));
-                       g_ptr_array_add (summary, (gpointer) node->message);
+               if (g_hash_table_lookup (have, uid)) {
+                       g_hash_table_remove (have, uid);
+                       g_ptr_array_add (summary, info);
                } else {
-                       camel_folder_free_message_info (thread->folder, (CamelMessageInfo *) node->message);
+                       camel_message_info_unref (info);
                }
 
                if (node->child)
@@ -743,7 +748,7 @@ camel_folder_thread_messages_unref (CamelFolderThread *thread)
                gint i;
 
                for (i = 0; i < thread->summary->len; i++)
-                       camel_folder_free_message_info (thread->folder, thread->summary->pdata[i]);
+                       camel_message_info_unref (thread->summary->pdata[i]);
                g_ptr_array_free (thread->summary, TRUE);
                g_object_unref (thread->folder);
        }
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 5b476fc..c2d86ac 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -420,7 +420,7 @@ folder_filter (CamelSession *session,
                                data->driver, NULL, info, uid, data->folder,
                                store_uid, store_uid, cancellable, error);
 
-                       camel_folder_free_message_info (data->folder, info);
+                       camel_message_info_unref (info);
                }
 
                camel_operation_pop_message (cancellable);
@@ -470,7 +470,7 @@ folder_transfer_message_to (CamelFolder *source,
        if ((source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
                        && (minfo = camel_folder_get_message_info (source, uid))) {
                info = camel_message_info_clone (minfo);
-               camel_folder_free_message_info (source, minfo);
+               camel_message_info_unref (minfo);
        } else
                info = camel_message_info_new_from_header (NULL, ((CamelMimePart *) msg)->headers);
 
@@ -882,15 +882,6 @@ folder_get_message_info (CamelFolder *folder,
 }
 
 static void
-folder_free_message_info (CamelFolder *folder,
-                          CamelMessageInfo *info)
-{
-       g_return_if_fail (folder->summary != NULL);
-
-       camel_message_info_unref (info);
-}
-
-static void
 folder_delete (CamelFolder *folder)
 {
        if (folder->summary)
@@ -1836,7 +1827,6 @@ camel_folder_class_init (CamelFolderClass *class)
        class->free_summary = folder_free_summary;
        class->search_free = folder_search_free;
        class->get_message_info = folder_get_message_info;
-       class->free_message_info = folder_free_message_info;
        class->delete_ = folder_delete;
        class->rename = folder_rename;
        class->freeze = folder_freeze;
@@ -2551,7 +2541,7 @@ camel_folder_set_message_user_tag (CamelFolder *folder,
  * @uid: the uid of a message
  *
  * Retrieve the #CamelMessageInfo for the specified @uid.  This return
- * must be freed using camel_folder_free_message_info().
+ * must be freed using camel_message_info_unref().
  *
  * Returns: the summary information for the indicated message, or %NULL
  * if the uid does not exist
@@ -2571,29 +2561,6 @@ camel_folder_get_message_info (CamelFolder *folder,
        return class->get_message_info (folder, uid);
 }
 
-/**
- * camel_folder_free_message_info:
- * @folder: a #CamelFolder
- * @info: a #CamelMessageInfo
- *
- * Free (unref) a #CamelMessageInfo, previously obtained with
- * camel_folder_get_message_info().
- **/
-void
-camel_folder_free_message_info (CamelFolder *folder,
-                                CamelMessageInfo *info)
-{
-       CamelFolderClass *class;
-
-       g_return_if_fail (CAMEL_IS_FOLDER (folder));
-       g_return_if_fail (info != NULL);
-
-       class = CAMEL_FOLDER_GET_CLASS (folder);
-       g_return_if_fail (class->free_message_info != NULL);
-
-       class->free_message_info (folder, info);
-}
-
 /* TODO: is this function required anyway? */
 /**
  * camel_folder_has_summary_capability:
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 33d82aa..49a2704 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -187,8 +187,6 @@ struct _CamelFolderClass {
        CamelMessageInfo *
                        (*get_message_info)     (CamelFolder *folder,
                                                 const gchar *uid);
-       void            (*free_message_info)    (CamelFolder *folder,
-                                                CamelMessageInfo *info);
        void            (*delete_)              (CamelFolder *folder);
        void            (*rename)               (CamelFolder *folder,
                                                 const gchar *newname);
@@ -471,8 +469,6 @@ guint32             camel_folder_count_by_expression (CamelFolder *folder,
 CamelMessageInfo *
                camel_folder_get_message_info   (CamelFolder *folder,
                                                 const gchar *uid);
-void           camel_folder_free_message_info  (CamelFolder *folder,
-                                                CamelMessageInfo *info);
 void           camel_folder_delete             (CamelFolder *folder);
 void           camel_folder_rename             (CamelFolder *folder,
                                                 const gchar *new_name);
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1d21dce..4a6c3ec 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -1598,7 +1598,7 @@ camel_vee_folder_get_location (CamelVeeFolder *vf,
 
                vfinfo = (CamelVeeMessageInfo *) camel_folder_get_message_info (folder, 
camel_message_info_uid (vinfo) + 8);
                res = camel_vee_folder_get_location ((CamelVeeFolder *) folder, vfinfo, realuid);
-               camel_folder_free_message_info (folder, (CamelMessageInfo *) vfinfo);
+               camel_message_info_unref ((CamelMessageInfo *) vinfo);
                return res;
        } else {
                if (realuid)
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 223eb57..4aff9b2 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -84,7 +84,7 @@ transfer_messages (CamelFolder *folder,
                CamelMessageInfo *mi = camel_folder_get_message_info (md->source_folder, 
md->source_uids->pdata[i]);
                if (mi) {
                        camel_message_info_set_flags (mi, md->sbit, md->sbit);
-                       camel_folder_free_message_info (md->source_folder, mi);
+                       camel_message_info_unref (mi);
                }
        }
 
@@ -204,7 +204,7 @@ vtrash_folder_transfer_messages_to_sync (CamelFolder *source,
                        g_ptr_array_add (md->uids, g_strdup (tuid));
                        g_ptr_array_add (md->source_uids, uids->pdata[i]);
                }
-               camel_folder_free_message_info (source, (CamelMessageInfo *) mi);
+               camel_message_info_unref (mi);
        }
 
        if (batch) {
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index c7faaa5..44ed503 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -38,7 +38,7 @@ test_folder_counts (CamelFolder *folder,
                info = camel_folder_get_message_info (folder, s->pdata[i]);
                if (camel_message_info_flags (info) & CAMEL_MESSAGE_SEEN)
                        myunread--;
-               camel_folder_free_message_info (folder, info);
+               camel_message_info_unref (info);
        }
        check (unread == myunread);
        camel_folder_free_uids (folder, s);
@@ -95,7 +95,7 @@ test_folder_message (CamelFolder *folder,
        info = camel_folder_get_message_info (folder, uid);
        check (info != NULL);
        check (strcmp (camel_message_info_uid (info), uid) == 0);
-       camel_folder_free_message_info (folder, info);
+       camel_message_info_unref (info);
 
        /* then, getting message */
        msg = camel_folder_get_message_sync (folder, uid, NULL, &error);
@@ -448,7 +448,7 @@ test_folder_message_ops (CamelSession *session,
                                check_msg (
                                        strcmp (camel_message_info_subject (info), subject) == 0,
                                        "info->subject %s", camel_message_info_subject (info));
-                               camel_folder_free_message_info (folder, info);
+                               camel_message_info_unref (info);
                        }
                        camel_folder_free_uids (folder, uids);
                        pull ();
@@ -501,7 +501,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_subject (info));
                        test_free (subject);
-                       camel_folder_free_message_info (folder, info);
+                       camel_message_info_unref (info);
                        pull ();
                }
 
@@ -530,7 +530,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_subject (info));
                        test_free (subject);
-                       camel_folder_free_message_info (folder, info);
+                       camel_message_info_unref (info);
                        pull ();
                }
                pull ();
@@ -561,7 +561,7 @@ test_folder_message_ops (CamelSession *session,
                                strcmp (camel_message_info_subject (info), subject) == 0,
                                "info->subject %s", camel_message_info_subject (info));
                        test_free (subject);
-                       camel_folder_free_message_info (folder, info);
+                       camel_message_info_unref (info);
                        pull ();
                }
                pull ();
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 54b45de..150da9f 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -439,7 +439,6 @@ camel_folder_search_by_uids
 camel_folder_search_free
 camel_folder_count_by_expression
 camel_folder_get_message_info
-camel_folder_free_message_info
 camel_folder_delete
 camel_folder_rename
 camel_folder_changed


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