aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-01-12 02:00:56 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-01-12 02:43:19 +0800
commitde978d42317423ceb3041d773913473d564a0ec4 (patch)
tree93caed2beebd7779ae5f6d35669d65cea0146469 /composer
parentadc0ad91c4e187d814d41edd69a6c53c6405f235 (diff)
downloadgsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.gz
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.zst
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.zip
Use g_hash_table_add() when using a hash table as a set.
g_hash_table_add(table, key) uses less memory than g_hash_table_insert(table, key, GINT_TO_POINTER (1)). Also use g_hash_table_contains() when testing for membership.
Diffstat (limited to 'composer')
-rw-r--r--composer/e-msg-composer.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 82f1b30f96..8d0252cc21 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -3041,10 +3041,7 @@ composer_add_auto_recipients (ESource *source,
const gchar *addr;
if (camel_internet_address_get (inet_addr, ii, &name, &addr))
- g_hash_table_insert (
- hash_table,
- g_strdup (addr),
- GINT_TO_POINTER (1));
+ g_hash_table_add (hash_table, g_strdup (addr));
}
g_object_unref (inet_addr);
@@ -3127,12 +3124,14 @@ e_msg_composer_new_with_message (EShell *shell,
if (postto == NULL) {
auto_cc = g_hash_table_new_full (
- camel_strcase_hash, camel_strcase_equal,
+ (GHashFunc) camel_strcase_hash,
+ (GEqualFunc) camel_strcase_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
auto_bcc = g_hash_table_new_full (
- camel_strcase_hash, camel_strcase_equal,
+ (GHashFunc) camel_strcase_hash,
+ (GEqualFunc) camel_strcase_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
@@ -3169,7 +3168,7 @@ e_msg_composer_new_with_message (EShell *shell,
e_destination_set_name (dest, name);
e_destination_set_email (dest, addr);
- if (g_hash_table_lookup (auto_cc, addr))
+ if (g_hash_table_contains (auto_cc, addr))
e_destination_set_auto_recipient (dest, TRUE);
Cc = g_list_append (Cc, dest);
@@ -3189,7 +3188,7 @@ e_msg_composer_new_with_message (EShell *shell,
e_destination_set_name (dest, name);
e_destination_set_email (dest, addr);
- if (g_hash_table_lookup (auto_bcc, addr))
+ if (g_hash_table_contains (auto_bcc, addr))
e_destination_set_auto_recipient (dest, TRUE);
Bcc = g_list_append (Bcc, dest);