diff --git a/ChangeLog b/ChangeLog index 725232a56b..40104bf103 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-07 David Hampton + + * src/engine/gnc-pricedb.c: Use the pointer to the commodity as a + hash key instead of looking up the commodity string and then + hashing that. Fixes 332678. + 2006-03-08 Andreas Köhler * configure.in: diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index e6d7f45978..94da203405 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -561,30 +561,8 @@ gnc_price_list_equal(GList *prices1, GList *prices2) description of GNCPrice lists). The top-level key is the commodity you want the prices for, and the second level key is the commodity that the value is expressed in terms of. - */ -static guint -commodity_hash (gconstpointer key) -{ - gnc_commodity * com = (gnc_commodity *) key; - - g_return_val_if_fail (key, 0); - - return g_str_hash (gnc_commodity_get_unique_name (com)); -} - -static gint -commodity_equal (gconstpointer a, gconstpointer b) -{ - gnc_commodity * ca = (gnc_commodity *) a; - gnc_commodity * cb = (gnc_commodity *) b; - - g_return_val_if_fail (a && b, FALSE); - - return gnc_commodity_equiv (ca, cb); -} - static GNCPriceDB * gnc_pricedb_create(QofBook * book) { @@ -612,7 +590,7 @@ gnc_pricedb_create(QofBook * book) provide one here. */ qof_collection_set_data (col, result); - result->commodity_hash = g_hash_table_new(commodity_hash, commodity_equal); + result->commodity_hash = g_hash_table_new(NULL, NULL); g_return_val_if_fail (result->commodity_hash, NULL); return result; } @@ -832,7 +810,7 @@ add_price(GNCPriceDB *db, GNCPrice *p) currency_hash = g_hash_table_lookup(db->commodity_hash, commodity); if(!currency_hash) { - currency_hash = g_hash_table_new(commodity_hash, commodity_equal); + currency_hash = g_hash_table_new(NULL, NULL); g_hash_table_insert(db->commodity_hash, commodity, currency_hash); }