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
This commit is contained in:
Andreas Köhler 2007-04-09 00:51:51 +00:00
parent ec22b196e5
commit f5e053f05d
3 changed files with 7 additions and 16 deletions

View File

@ -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)

View File

@ -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 );
/** @} */

View File

@ -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 */
{