gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon Jul 5 17:53:52 EDT 2021
Updated via https://github.com/Gnucash/gnucash/commit/06fc58c3 (commit)
via https://github.com/Gnucash/gnucash/commit/08b56e96 (commit)
from https://github.com/Gnucash/gnucash/commit/2187cea6 (commit)
commit 06fc58c39d3d48e2844987a332821a3a1c066f31
Merge: 2187cea64 08b56e966
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Jul 5 14:48:48 2021 -0700
Merge Simon Arlott's 'load-pricedb-faster' into maint.
commit 08b56e966939f1517429d32fdeea9406b939228e
Author: Simon Arlott <sa.me.uk>
Date: Mon Jul 5 20:10:27 2021 +0100
[gnc-pricedb] Don't lookup old prices when doing bulk updates
diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c
index 8b41c1078..3dd48eb4f 100644
--- a/libgnucash/engine/gnc-pricedb.c
+++ b/libgnucash/engine/gnc-pricedb.c
@@ -1075,7 +1075,6 @@ add_price(GNCPriceDB *db, GNCPrice *p)
gnc_commodity *commodity;
gnc_commodity *currency;
GHashTable *currency_hash;
- GNCPrice *old_price;
if (!db || !p) return FALSE;
ENTER ("db=%p, pr=%p dirty=%d destroying=%d",
@@ -1112,17 +1111,20 @@ add_price(GNCPriceDB *db, GNCPrice *p)
* add this one. If this price is of equal or better precedence than the old
* one, copy this one over the old one.
*/
- old_price = gnc_pricedb_lookup_day_t64 (db, p->commodity, p->currency,
- p->tmspec);
- if (!db->bulk_update && old_price != NULL)
+ if (!db->bulk_update)
{
- if (p->source > old_price->source)
+ GNCPrice *old_price = gnc_pricedb_lookup_day_t64(db, p->commodity,
+ p->currency, p->tmspec);
+ if (old_price != NULL)
{
- gnc_price_unref(p);
- LEAVE ("Better price already in DB.");
- return FALSE;
+ if (p->source > old_price->source)
+ {
+ gnc_price_unref(p);
+ LEAVE ("Better price already in DB.");
+ return FALSE;
+ }
+ gnc_pricedb_remove_price(db, old_price);
}
- gnc_pricedb_remove_price(db, old_price);
}
currency_hash = g_hash_table_lookup(db->commodity_hash, commodity);
Summary of changes:
libgnucash/engine/gnc-pricedb.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
More information about the gnucash-changes
mailing list