gnucash maint: Complete reversion of e81bcf6 in gnc-pricedb.c.

John Ralls jralls at code.gnucash.org
Wed Jan 23 20:57:32 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/3a486727 (commit)
	from  https://github.com/Gnucash/gnucash/commit/9069bace (commit)



commit 3a4867276354a66c1b11d631398fdb71a6852d92
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Jan 23 17:50:22 2019 -0800

    Complete reversion of e81bcf6 in gnc-pricedb.c.

diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c
index 102c2d9..a39ba7e 100644
--- a/libgnucash/engine/gnc-pricedb.c
+++ b/libgnucash/engine/gnc-pricedb.c
@@ -2196,7 +2196,7 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
                merged currency list. */
             GList **price_array = (GList **)g_new(gpointer, num_currencies);
             GList **next_list;
-            int i, j, k;
+            int i, j;
             GHashTableIter iter;
             gpointer key, value;
 
@@ -2208,16 +2208,14 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
                 price_array[i] = value;
             }
 
-            /* Iterate up to n times (there are i prices, so going past i will run off the end of the array) to get the nth price, each time finding the currency
-               with the latest price */
-            for (k = 0; k <= n && k < i; ++k)
+            for (i = 0; i <= n; ++i)
             {
                 next_list = NULL;
-                for (j = 0; j < i; ++j)
+                for (j = 0; j < num_currencies; ++j)
                 {
                     /* Save this entry if it's the first one or later than
                        the saved one. */
-                    if (price_array[k] != NULL &&
+                    if (price_array[j] != NULL &&
                         (next_list == NULL || *next_list == NULL ||
                         compare_prices_by_date((*next_list)->data, (price_array[j])->data) > 0))
                     {



Summary of changes:
 libgnucash/engine/gnc-pricedb.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list