r15851 - gnucash/trunk/src - Rename g_date_equals to gnc_gdate_equal and g_date_hash to gnc_gdate_hash.
Andreas Köhler
andi5 at cvs.gnucash.org
Sun Apr 8 20:51:56 EDT 2007
Author: andi5
Date: 2007-04-08 20:51:51 -0400 (Sun, 08 Apr 2007)
New Revision: 15851
Trac: http://svn.gnucash.org/trac/changeset/15851
Modified:
gnucash/trunk/src/core-utils/gnc-gdate-utils.c
gnucash/trunk/src/core-utils/gnc-gdate-utils.h
gnucash/trunk/src/gnome/druid-loan.c
Log:
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.
Modified: gnucash/trunk/src/core-utils/gnc-gdate-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gdate-utils.c 2007-04-09 00:51:45 UTC (rev 15850)
+++ gnucash/trunk/src/core-utils/gnc-gdate-utils.c 2007-04-09 00:51:51 UTC (rev 15851)
@@ -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)
Modified: gnucash/trunk/src/core-utils/gnc-gdate-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gdate-utils.h 2007-04-09 00:51:45 UTC (rev 15850)
+++ gnucash/trunk/src/core-utils/gnc-gdate-utils.h 2007-04-09 00:51:51 UTC (rev 15851)
@@ -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 );
/** @} */
Modified: gnucash/trunk/src/gnome/druid-loan.c
===================================================================
--- gnucash/trunk/src/gnome/druid-loan.c 2007-04-09 00:51:45 UTC (rev 15850)
+++ gnucash/trunk/src/gnome/druid-loan.c 2007-04-09 00:51:51 UTC (rev 15851)
@@ -2631,7 +2631,7 @@
* 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 */
{
More information about the gnucash-changes
mailing list