2001-05-28 Dave Peticolas <dave@krondo.com>

* src/engine/gnc-pricedb.c (compare_prices_by_date): stabilize
	sort using guids

	* src/engine/gnc-pricedb-xml-v1.c (price_parse_xml_sub_node): fix
	mem leak


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4324 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-05-28 20:15:59 +00:00
parent 2fbe97d371
commit 60bc063d9e
3 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,11 @@
2001-05-28 Dave Peticolas <dave@krondo.com>
* src/engine/gnc-pricedb.c (compare_prices_by_date): stabilize
sort using guids
* src/engine/gnc-pricedb-xml-v1.c (price_parse_xml_sub_node): fix
mem leak
2001-05-27 Christian Stimming <stimming@tuhh.de>
* src/scm/tip-list.scm: edited some tips after consultation with

View File

@@ -98,6 +98,7 @@ price_parse_xml_sub_node(GNCPrice *p, xmlNodePtr sub_node)
GUID *c = dom_tree_to_guid(sub_node);
if(!c) return FALSE;
gnc_price_set_guid(p, c);
g_free(c);
} else if(safe_strcmp("price:commodity", sub_node->name) == 0) {
gnc_commodity *c = dom_tree_to_commodity_ref(sub_node);
if(!c) return FALSE;

View File

@@ -362,6 +362,8 @@ compare_prices_by_date(gconstpointer a, gconstpointer b)
{
Timespec time_a;
Timespec time_b;
gint result;
if(!a && !b) return 0;
/* nothing is always less than something */
if(!a) return -1;
@@ -369,7 +371,12 @@ compare_prices_by_date(gconstpointer a, gconstpointer b)
time_a = gnc_price_get_time((GNCPrice *) a);
time_b = gnc_price_get_time((GNCPrice *) b);
return -timespec_cmp(&time_a, &time_b);
result = -timespec_cmp(&time_a, &time_b);
if (result) return result;
/* For a stable sort */
return guid_compare (gnc_price_get_guid((GNCPrice *) a),
gnc_price_get_guid((GNCPrice *) b));
}
gboolean