aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
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 /e-util
parentadc0ad91c4e187d814d41edd69a6c53c6405f235 (diff)
downloadgsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.gz
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.bz2
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.lz
gsoc2013-evolution-de978d42317423ceb3041d773913473d564a0ec4.tar.xz
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 'e-util')
-rw-r--r--e-util/e-table-field-chooser-item.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/e-util/e-table-field-chooser-item.c b/e-util/e-table-field-chooser-item.c
index f72e059f20..c7335f8a5c 100644
--- a/e-util/e-table-field-chooser-item.c
+++ b/e-util/e-table-field-chooser-item.c
@@ -128,19 +128,23 @@ etfci_rebuild_combined (ETableFieldChooserItem *etfci)
ETableCol *ecol = e_table_header_get_column (etfci->header, i);
if (ecol->disabled)
continue;
- g_hash_table_insert (
- hash, GINT_TO_POINTER (ecol->col_idx),
- GINT_TO_POINTER (1));
+ g_hash_table_add (hash, GINT_TO_POINTER (ecol->col_idx));
}
count = e_table_header_count (etfci->full_header);
for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (etfci->full_header, i);
+ ETableCol *ecol;
+ gpointer key;
+
+ ecol = e_table_header_get_column (etfci->full_header, i);
+ key = GINT_TO_POINTER (ecol->col_idx);
+
if (ecol->disabled)
continue;
- if (!(GPOINTER_TO_INT (g_hash_table_lookup (
- hash, GINT_TO_POINTER (ecol->col_idx)))))
- e_table_header_add_column (etfci->combined_header, ecol, -1);
+
+ if (!g_hash_table_contains (hash, key))
+ e_table_header_add_column (
+ etfci->combined_header, ecol, -1);
}
g_hash_table_destroy (hash);