From de978d42317423ceb3041d773913473d564a0ec4 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
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.
---
 mail/em-composer-utils.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'mail/em-composer-utils.c')

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);
 			}
 		}
 	}
-- 
cgit