From f5e053f05d6300d4b20a47a156d5da27a955874c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Mon, 9 Apr 2007 00:51:51 +0000 Subject: [PATCH] Rename g_date_equals to gnc_gdate_equal and g_date_hash to gnc_gdate_hash. Those are not native GLib functions. Make _equals consistent with g_{str,int}_equal, also return a gboolean. g_date_compare checks its parameters for validity already, so do not do that twice. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15851 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/core-utils/gnc-gdate-utils.c | 17 ++++------------- src/core-utils/gnc-gdate-utils.h | 4 ++-- src/gnome/druid-loan.c | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/core-utils/gnc-gdate-utils.c b/src/core-utils/gnc-gdate-utils.c index 80735f2ce7..c309d46abe 100644 --- a/src/core-utils/gnc-gdate-utils.c +++ b/src/core-utils/gnc-gdate-utils.c @@ -28,23 +28,14 @@ #include "gnc-gdate-utils.h" -gint -g_date_equals( gconstpointer gda, gconstpointer gdb ) +gboolean +gnc_gdate_equal(gconstpointer gda, gconstpointer gdb) { - if ( !g_date_valid( (GDate*)gda ) - || !g_date_valid( (GDate*)gdb ) ) { -#if 0 - DEBUG( "invalid: %p(%s), %p(%s)", - gda, ( g_date_valid((GDate*)gda) ? "" : "*" ), - gdb, ( g_date_valid((GDate*)gdb) ? "" : "*" ) ); -#endif - } - return ( g_date_compare( (GDate*)gda, (GDate*)gdb ) - == 0 ? TRUE : FALSE ); + return (g_date_compare( (GDate*)gda, (GDate*)gdb ) == 0 ? TRUE : FALSE); } guint -g_date_hash( gconstpointer gd ) +gnc_gdate_hash( gconstpointer gd ) { gint val = (g_date_get_year( (GDate*)gd ) * 10000) + (g_date_get_month( (GDate*)gd ) * 100) diff --git a/src/core-utils/gnc-gdate-utils.h b/src/core-utils/gnc-gdate-utils.h index e22bbf97db..479d2b14b0 100644 --- a/src/core-utils/gnc-gdate-utils.h +++ b/src/core-utils/gnc-gdate-utils.h @@ -44,12 +44,12 @@ /** Compares two GDate*'s for equality; useful for using GDate*'s as * GHashTable keys. */ -gint g_date_equals( gconstpointer gda, gconstpointer gdb ); +gint gnc_gdate_equal(gconstpointer gda, gconstpointer gdb); /** Provides a "hash" of a GDate* value; useful for using GDate*'s as * GHashTable keys. */ -guint g_date_hash( gconstpointer gd ); +guint gnc_gdate_hash( gconstpointer gd ); /** @} */ diff --git a/src/gnome/druid-loan.c b/src/gnome/druid-loan.c index 8f22a5dfc2..6eb806bd9e 100644 --- a/src/gnome/druid-loan.c +++ b/src/gnome/druid-loan.c @@ -2631,7 +2631,7 @@ ld_rev_recalc_schedule( LoanDruidData *ldd ) * row-of-gnc_numeric[N] data, where N is the number of columns as * determined by the _prep function, and stored in * LoanData::revNumPmts. */ - repayment_schedule = g_hash_table_new( g_date_hash, g_date_equals ); + repayment_schedule = g_hash_table_new(gnc_gdate_hash, gnc_gdate_equal); /* Do the master repayment */ {