[evolution-data-server] Avoid camel_store_info_string().



commit f1669e9f234ba08624e03f51dcfb9a02a78c53c9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Aug 16 11:11:24 2013 -0400

    Avoid camel_store_info_string().
    
    It's not like calling the function is any more thread-safe than just
    accessing the CamelStoreInfo struct member directly.
    
    Avoid the function so we can get rid of it.

 camel/camel-imapx-store-summary.c               |   28 +---------------------
 camel/camel-imapx-store-summary.h               |    6 -----
 camel/camel-imapx-store.c                       |    5 +--
 camel/providers/nntp/camel-nntp-store-summary.c |   25 +------------------
 camel/providers/nntp/camel-nntp-store-summary.h |    7 -----
 docs/reference/camel/camel-sections.txt         |    1 -
 6 files changed, 6 insertions(+), 66 deletions(-)
---
diff --git a/camel/camel-imapx-store-summary.c b/camel/camel-imapx-store-summary.c
index a6da17b..95674af 100644
--- a/camel/camel-imapx-store-summary.c
+++ b/camel/camel-imapx-store-summary.c
@@ -47,7 +47,6 @@ static CamelStoreInfo * store_info_load (CamelStoreSummary *, FILE *);
 static gint             store_info_save (CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void             store_info_free (CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string (CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string (CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 G_DEFINE_TYPE (CamelIMAPXStoreSummary, camel_imapx_store_summary, CAMEL_TYPE_STORE_SUMMARY)
@@ -80,7 +79,6 @@ camel_imapx_store_summary_class_init (CamelIMAPXStoreSummaryClass *class)
        store_summary_class->store_info_load = store_info_load;
        store_summary_class->store_info_save = store_info_save;
        store_summary_class->store_info_free = store_info_free;
-       store_summary_class->store_info_string = store_info_string;
        store_summary_class->store_info_set_string = store_info_set_string;
 }
 
@@ -188,7 +186,7 @@ camel_imapx_store_summary_path_to_full (CamelIMAPXStoreSummary *s,
 
        /* path is already present, use the raw version we have */
        if (si && strlen (subpath) == strlen (path)) {
-               f = g_strdup (camel_imapx_store_info_full_name (s, si));
+               f = g_strdup (((CamelIMAPXStoreInfo *) si)->full_name);
                camel_store_summary_info_unref ((CamelStoreSummary *) s, si);
                return f;
        }
@@ -216,7 +214,7 @@ camel_imapx_store_summary_path_to_full (CamelIMAPXStoreSummary *s,
        /* merge old path part if required */
        f = full;
        if (si) {
-               full = g_strdup_printf ("%s%s", camel_imapx_store_info_full_name (s, si), f);
+               full = g_strdup_printf ("%s%s", ((CamelIMAPXStoreInfo *) si)->full_name, f);
                g_free (f);
                camel_store_summary_info_unref ((CamelStoreSummary *) s, si);
                f = full;
@@ -608,28 +606,6 @@ store_info_free (CamelStoreSummary *s,
        store_summary_class->store_info_free (s, mi);
 }
 
-static const gchar *
-store_info_string (CamelStoreSummary *s,
-                   const CamelStoreInfo *mi,
-                   gint type)
-{
-       CamelIMAPXStoreInfo *isi = (CamelIMAPXStoreInfo *) mi;
-       CamelStoreSummaryClass *store_summary_class;
-
-       /* FIXME: Locks? */
-
-       g_assert (mi != NULL);
-
-       store_summary_class = CAMEL_STORE_SUMMARY_CLASS (camel_imapx_store_summary_parent_class);
-
-       switch (type) {
-       case CAMEL_IMAPX_STORE_INFO_FULL_NAME:
-               return isi->full_name;
-       default:
-               return store_summary_class->store_info_string (s, mi, type);
-       }
-}
-
 static void
 store_info_set_string (CamelStoreSummary *s,
                        CamelStoreInfo *mi,
diff --git a/camel/camel-imapx-store-summary.h b/camel/camel-imapx-store-summary.h
index 9834373..52e054f 100644
--- a/camel/camel-imapx-store-summary.h
+++ b/camel/camel-imapx-store-summary.h
@@ -136,12 +136,6 @@ gchar *            camel_imapx_store_summary_full_from_path
                                                (CamelIMAPXStoreSummary *s,
                                                 const gchar *path);
 
-/* helpe macro's */
-#define camel_imapx_store_info_full_name(s, i) \
-       (camel_store_info_string ( \
-               (CamelStoreSummary *) s, (const CamelStoreInfo *) i, \
-               CAMEL_IMAPX_STORE_INFO_FULL_NAME))
-
 G_END_DECLS
 
 #endif /* CAMEL_IMAP_STORE_SUMMARY_H */
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index d37bce0..c413249 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -1007,7 +1007,7 @@ get_folder_info_offline (CamelStore *store,
                if (si == NULL)
                        continue;
 
-               full_name = camel_imapx_store_info_full_name (imapx_store->summary, si);
+               full_name = ((CamelIMAPXStoreInfo *) si)->full_name;
                if (!full_name || !*full_name) {
                        camel_store_summary_info_unref ((CamelStoreSummary *) imapx_store->summary, si);
                        continue;
@@ -1315,8 +1315,7 @@ sync_folders (CamelIMAPXStore *imapx_store,
                if (si == NULL)
                        continue;
 
-               full_name =
-                       camel_imapx_store_info_full_name (store_summary, si);
+               full_name = ((CamelIMAPXStoreInfo *) si)->full_name;
                if (full_name == NULL || *full_name == '\0')
                        goto endloop;
 
diff --git a/camel/providers/nntp/camel-nntp-store-summary.c b/camel/providers/nntp/camel-nntp-store-summary.c
index 388ab06..afb8a5d 100644
--- a/camel/providers/nntp/camel-nntp-store-summary.c
+++ b/camel/providers/nntp/camel-nntp-store-summary.c
@@ -45,7 +45,6 @@ static CamelStoreInfo * store_info_load (CamelStoreSummary *, FILE *);
 static gint             store_info_save (CamelStoreSummary *, FILE *, CamelStoreInfo *);
 static void             store_info_free (CamelStoreSummary *, CamelStoreInfo *);
 
-static const gchar *store_info_string (CamelStoreSummary *, const CamelStoreInfo *, gint);
 static void store_info_set_string (CamelStoreSummary *, CamelStoreInfo *, int, const gchar *);
 
 G_DEFINE_TYPE (CamelNNTPStoreSummary, camel_nntp_store_summary, CAMEL_TYPE_STORE_SUMMARY)
@@ -61,7 +60,6 @@ camel_nntp_store_summary_class_init (CamelNNTPStoreSummaryClass *class)
        store_summary_class->store_info_load = store_info_load;
        store_summary_class->store_info_save = store_info_save;
        store_summary_class->store_info_free = store_info_free;
-       store_summary_class->store_info_string = store_info_string;
        store_summary_class->store_info_set_string = store_info_set_string;
 }
 
@@ -190,7 +188,7 @@ camel_nntp_store_summary_path_to_full (CamelNNTPStoreSummary *s,
 
        /* path is already present, use the raw version we have */
        if (si && strlen (subpath) == strlen (path)) {
-               f = g_strdup (camel_nntp_store_info_full_name (s, si));
+               f = g_strdup (((CamelNNTPStoreInfo *) si)->full_name);
                camel_store_summary_info_unref ((CamelStoreSummary *) s, si);
                return f;
        }
@@ -228,7 +226,7 @@ camel_nntp_store_summary_path_to_full (CamelNNTPStoreSummary *s,
        /* merge old path part if required */
        f = camel_utf8_utf7 (full);
        if (si) {
-               full = g_strdup_printf ("%s%s", camel_nntp_store_info_full_name (s, si), f);
+               full = g_strdup_printf ("%s%s", ((CamelNNTPStoreInfo *) si)->full_name, f);
                g_free (f);
                camel_store_summary_info_unref ((CamelStoreSummary *) s, si);
                f = full;
@@ -366,25 +364,6 @@ store_info_free (CamelStoreSummary *s,
        CAMEL_STORE_SUMMARY_CLASS (camel_nntp_store_summary_parent_class)->store_info_free (s, mi);
 }
 
-static const gchar *
-store_info_string (CamelStoreSummary *s,
-                   const CamelStoreInfo *mi,
-                   gint type)
-{
-       CamelNNTPStoreInfo *nsi = (CamelNNTPStoreInfo *) mi;
-
-       /* FIXME: Locks? */
-
-       g_assert (mi != NULL);
-
-       switch (type) {
-       case CAMEL_NNTP_STORE_INFO_FULL_NAME:
-               return nsi->full_name;
-       default:
-               return CAMEL_STORE_SUMMARY_CLASS (camel_nntp_store_summary_parent_class)->store_info_string 
(s, mi, type);
-       }
-}
-
 static void
 store_info_set_string (CamelStoreSummary *s,
                        CamelStoreInfo *mi,
diff --git a/camel/providers/nntp/camel-nntp-store-summary.h b/camel/providers/nntp/camel-nntp-store-summary.h
index 7f61b34..c8275b6 100644
--- a/camel/providers/nntp/camel-nntp-store-summary.h
+++ b/camel/providers/nntp/camel-nntp-store-summary.h
@@ -85,13 +85,6 @@ GType                camel_nntp_store_summary_get_type
 CamelNNTPStoreSummary *
                camel_nntp_store_summary_new    (void);
 
-/* helper macro's */
-#define camel_nntp_store_info_full_name(s, i) \
-       (camel_store_info_string ( \
-               (CamelStoreSummary *) s, \
-               (const CamelStoreInfo *) i, \
-               CAMEL_NNTP_STORE_INFO_FULL_NAME))
-
 /* converts to/from utf8 canonical nasmes */
 gchar *                camel_nntp_store_summary_full_to_path
                                                (CamelNNTPStoreSummary *s,
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index b1e9666..d9563f9 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -1042,7 +1042,6 @@ camel_imapx_store_summary_path_to_full
 camel_imapx_store_summary_full_name
 camel_imapx_store_summary_add_from_full
 camel_imapx_store_summary_full_from_path
-camel_imapx_store_info_full_name
 <SUBSECTION Standard>
 CAMEL_IMAPX_STORE_SUMMARY
 CAMEL_IS_IMAPX_STORE_SUMMARY


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