diff --git a/ChangeLog b/ChangeLog index 39e5cc8053..7bbcb14403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-08-06 Dave Peticolas + + * src/engine/sql/upgrade.h: fix warning + + * src/engine/gnc-pricedb.[ch] (gnc_price_equal): new func + + * src/engine/FreqSpec.c: add comment + 2001-08-05 Dave Peticolas * src/gnome/window-register.c: move close button to left diff --git a/src/engine/FreqSpec.c b/src/engine/FreqSpec.c index 86df20f0dc..14af38b494 100644 --- a/src/engine/FreqSpec.c +++ b/src/engine/FreqSpec.c @@ -124,7 +124,10 @@ struct monthDesc { /* This stuff is going to need i18n. * wouldn't it be simpler to use the system * date conversion functions? - * glib already knows about this. */ + * glib already knows about this. + * *libc* already knows about this + * and the month names below. Both + * of these should go away! */ static char *weekDayNames[] = { "Sunday", "Monday", diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index 3b9cd40950..dc4016a95e 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -428,6 +428,44 @@ gnc_price_get_version(GNCPrice *p) return (p->version); } +gboolean +gnc_price_equal (GNCPrice *p1, GNCPrice *p2) +{ + Timespec ts1; + Timespec ts2; + + if (p1 == p2) return TRUE; + if (!p1 || !p2) return FALSE; + + if (!gnc_commodity_equiv (gnc_price_get_commodity (p1), + gnc_price_get_commodity (p2))) + return FALSE; + + if (!gnc_commodity_equiv (gnc_price_get_currency (p1), + gnc_price_get_currency (p2))) + return FALSE; + + ts1 = gnc_price_get_time (p1); + ts2 = gnc_price_get_time (p2); + + if (!timespec_equal (&ts1, &ts2)) + return FALSE; + + if (!safe_strcmp (gnc_price_get_source (p1), + gnc_price_get_source (p2))) + return FALSE; + + if (!safe_strcmp (gnc_price_get_type (p1), + gnc_price_get_type (p2))) + return FALSE; + + if (!gnc_numeric_eq (gnc_price_get_value (p1), + gnc_price_get_value (p2))) + return FALSE; + + return TRUE; +} + /* ==================================================================== */ /* price list manipulation functions */ diff --git a/src/engine/gnc-pricedb.h b/src/engine/gnc-pricedb.h index 9d64d60254..dac158bb29 100644 --- a/src/engine/gnc-pricedb.h +++ b/src/engine/gnc-pricedb.h @@ -172,6 +172,8 @@ const char * gnc_price_get_type(GNCPrice *p); gnc_numeric gnc_price_get_value(GNCPrice *p); gint32 gnc_price_get_version(GNCPrice *p); +gboolean gnc_price_equal (GNCPrice *p1, GNCPrice *p2); + /********************************************************************** GNCPrice lists: diff --git a/src/engine/sql/upgrade.h b/src/engine/sql/upgrade.h index eb20721695..6f1c6e0d2b 100644 --- a/src/engine/sql/upgrade.h +++ b/src/engine/sql/upgrade.h @@ -38,4 +38,4 @@ int pgendDBVersionIsCurrent (PGBackend *be); void pgendUpgradeDB (PGBackend *be); -#endif PGEND_UPGRADE_H +#endif /* PGEND_UPGRADE_H */