[Gnucash-changes] r13528 - gnucash/trunk - Use the pointer to the
commodity as a hash key instead of looking up
David Hampton
hampton at cvs.gnucash.org
Tue Mar 7 19:06:36 EST 2006
Author: hampton
Date: 2006-03-07 19:06:35 -0500 (Tue, 07 Mar 2006)
New Revision: 13528
Trac: http://svn.gnucash.org/trac/changeset/13528
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/engine/gnc-pricedb.c
Log:
Use the pointer to the commodity as a hash key instead of looking up
the commodity string and then hashing that. Fixes 332678.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-03-07 23:15:04 UTC (rev 13527)
+++ gnucash/trunk/ChangeLog 2006-03-08 00:06:35 UTC (rev 13528)
@@ -1,3 +1,9 @@
+2006-03-07 David Hampton <hampton at employees.org>
+
+ * 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 <andi5.py at gmx.net>
* configure.in:
Modified: gnucash/trunk/src/engine/gnc-pricedb.c
===================================================================
--- gnucash/trunk/src/engine/gnc-pricedb.c 2006-03-07 23:15:04 UTC (rev 13527)
+++ gnucash/trunk/src/engine/gnc-pricedb.c 2006-03-08 00:06:35 UTC (rev 13528)
@@ -561,30 +561,8 @@
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 @@
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 @@
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);
}
More information about the gnucash-changes
mailing list