From de978d42317423ceb3041d773913473d564a0ec4 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 11 Jan 2013 13:00:56 -0500 Subject: 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. --- libemail-engine/e-mail-utils.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'libemail-engine/e-mail-utils.c') diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c index 30eee6242a..750e8cce51 100644 --- a/libemail-engine/e-mail-utils.c +++ b/libemail-engine/e-mail-utils.c @@ -1104,7 +1104,7 @@ mail_account_in_recipients (ESourceRegistry *registry, g_object_unref (source); if (address != NULL) { - match = (g_hash_table_lookup (recipients, address) != NULL); + match = g_hash_table_contains (recipients, address); g_free (address); } @@ -1141,9 +1141,7 @@ em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry, gint index = 0; while (camel_internet_address_get (addr, index++, NULL, &key)) - g_hash_table_insert ( - recipients, (gpointer) key, - GINT_TO_POINTER (1)); + g_hash_table_add (recipients, (gpointer) key); } type = CAMEL_RECIPIENT_TYPE_CC; @@ -1152,9 +1150,7 @@ em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry, gint index = 0; while (camel_internet_address_get (addr, index++, NULL, &key)) - g_hash_table_insert ( - recipients, (gpointer) key, - GINT_TO_POINTER (1)); + g_hash_table_add (recipients, (gpointer) key); } /* First Preference: We were given a folder that maps to an -- cgit