diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-01-12 02:00:56 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-01-12 02:43:19 +0800 |
commit | de978d42317423ceb3041d773913473d564a0ec4 (patch) | |
tree | 93caed2beebd7779ae5f6d35669d65cea0146469 /mail/em-composer-utils.c | |
parent | adc0ad91c4e187d814d41edd69a6c53c6405f235 (diff) | |
download | gsoc2013-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 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index f75b83826a..204188f4e4 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -2405,9 +2405,9 @@ concat_unique_addrs (CamelInternetAddress *dest, gint i; for (i = 0; camel_internet_address_get (src, i, &name, &addr); i++) { - if (!g_hash_table_lookup (rcpt_hash, addr)) { + if (!g_hash_table_contains (rcpt_hash, addr)) { camel_internet_address_add (dest, name, addr); - g_hash_table_insert (rcpt_hash, (gchar *) addr, GINT_TO_POINTER (1)); + g_hash_table_add (rcpt_hash, (gpointer) addr); } } } @@ -2542,15 +2542,13 @@ em_utils_get_reply_all (ESourceRegistry *registry, while (camel_internet_address_get (reply_to, ii++, &name, &addr)) { /* Ignore references to the Reply-To address * in the To and Cc lists. */ - if (addr && !g_hash_table_lookup (rcpt_hash, addr)) { + if (addr && !g_hash_table_contains (rcpt_hash, addr)) { /* In the case we are doing a Reply-To-All, * we do not want to include the user's email * address because replying to oneself is * kinda silly. */ camel_internet_address_add (to, name, addr); - g_hash_table_insert ( - rcpt_hash, (gchar *) addr, - GINT_TO_POINTER (1)); + g_hash_table_add (rcpt_hash, (gpointer) addr); } } } |