From 422bf34bfe13198c20addb90b9d882be8463152a Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Mon, 10 Apr 2006 22:20:12 +0000 Subject: [PATCH] Get gnucash to build properly with the new QOF changes (0.6.4+) * src/backend/file/sixtp-utils.c: use QOF_SCANF_LLD to read 64-bit numbers. * src/gnome-utils/QuickFill.c: * src/engine/gnc-pricedb.c: * src/engine/Transaction.c: * src/engine/gnc-commodity.c: convert gnc_string_cache* APIs to CACHE_* APIs. * src/engine/Account.c: Properly convert usage of SAFE_STRCMP() to safe_strcmp() * src/engine/kvp-scm.c: #include instead of * src/engine/gnc-engine.c: Update the method used to shutdown QOF. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13765 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 14 ++++++++++++++ src/backend/file/sixtp-utils.c | 2 +- src/engine/Account.c | 4 +++- src/engine/Transaction.c | 16 ++++++++-------- src/engine/gnc-commodity.c | 8 ++++---- src/engine/gnc-engine.c | 5 +---- src/engine/gnc-pricedb.c | 12 ++++++------ src/engine/kvp-scm.c | 2 +- src/gnome-utils/QuickFill.c | 10 +++++----- 9 files changed, 43 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index a141478865..d570244606 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,20 @@ Keep the deprecated GNC_SCANF_LLD defined in terms of the new QOF_SCANF_LLD. + * src/backend/file/sixtp-utils.c: + use QOF_SCANF_LLD to read 64-bit numbers. + * src/gnome-utils/QuickFill.c: + * src/engine/gnc-pricedb.c: + * src/engine/Transaction.c: + * src/engine/gnc-commodity.c: + convert gnc_string_cache* APIs to CACHE_* APIs. + * src/engine/Account.c: + Properly convert usage of SAFE_STRCMP() to safe_strcmp() + * src/engine/kvp-scm.c: + #include instead of + * src/engine/gnc-engine.c: + Update the method used to shutdown QOF. + 2006-04-08 David Hampton * src/gnome-utils/account-quickfill.c: Eliminate some unnecessary diff --git a/src/backend/file/sixtp-utils.c b/src/backend/file/sixtp-utils.c index 6a14f86e5c..6a7a30c2df 100644 --- a/src/backend/file/sixtp-utils.c +++ b/src/backend/file/sixtp-utils.c @@ -220,7 +220,7 @@ string_to_gint64(const gchar *str, gint64 *v) g_return_val_if_fail(str, FALSE); /* must use "<" here because %n's effects aren't well defined */ - if(sscanf(str, " " GNC_SCANF_LLD "%n", &v_in, &num_read) < 1) { + if(sscanf(str, " " QOF_SCANF_LLD "%n", &v_in, &num_read) < 1) { return(FALSE); } diff --git a/src/engine/Account.c b/src/engine/Account.c index 46c3d1e41b..1256f94b34 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -999,7 +999,9 @@ xaccAccountOrder (const Account **aa, const Account **ab) } /* Otherwise do a string sort */ - SAFE_STRCMP (da, db); + result = safe_strcmp (da, db); + if (result) + return result; /* if acccount-type-order array not initialized, initialize it */ /* this will happen at most once during program invocation */ diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 83823b2139..9edbe63510 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -242,8 +242,8 @@ xaccInitTransaction (Transaction * trans, QofBook *book) { ENTER ("trans=%p", trans); /* Fill in some sane defaults */ - trans->num = gnc_string_cache_insert(""); - trans->description = gnc_string_cache_insert(""); + trans->num = CACHE_INSERT(""); + trans->description = CACHE_INSERT(""); trans->common_currency = NULL; trans->splits = NULL; @@ -358,8 +358,8 @@ xaccDupeTransaction (const Transaction *t) trans = g_new0 (Transaction, 1); - trans->num = gnc_string_cache_insert (t->num); - trans->description = gnc_string_cache_insert (t->description); + trans->num = CACHE_INSERT (t->num); + trans->description = CACHE_INSERT (t->description); trans->splits = g_list_copy (t->splits); for (node = trans->splits; node; node = node->next) @@ -405,8 +405,8 @@ xaccTransClone (const Transaction *t) trans->date_entered = t->date_entered; trans->date_posted = t->date_posted; - trans->num = gnc_string_cache_insert (t->num); - trans->description = gnc_string_cache_insert (t->description); + trans->num = CACHE_INSERT (t->num); + trans->description = CACHE_INSERT (t->description); trans->common_currency = t->common_currency; trans->version = t->version; trans->version_check = t->version_check; @@ -458,8 +458,8 @@ xaccFreeTransaction (Transaction *trans) trans->splits = NULL; /* free up transaction strings */ - gnc_string_cache_remove(trans->num); - gnc_string_cache_remove(trans->description); + CACHE_REMOVE(trans->num); + CACHE_REMOVE(trans->description); /* Just in case someone looks up freed memory ... */ trans->num = (char *) 1; diff --git a/src/engine/gnc-commodity.c b/src/engine/gnc-commodity.c index 70cd4e60bf..7956546cec 100644 --- a/src/engine/gnc-commodity.c +++ b/src/engine/gnc-commodity.c @@ -1239,7 +1239,7 @@ gnc_commodity_table_insert(gnc_commodity_table * table, PINFO ("insert %p %s into nsp=%p %s", comm->mnemonic, comm->mnemonic, nsp->cm_table, nsp->name); g_hash_table_insert(nsp->cm_table, - gnc_string_cache_insert(comm->mnemonic), + CACHE_INSERT(comm->mnemonic), (gpointer)comm); nsp->cm_list = g_list_append(nsp->cm_list, comm); @@ -1482,7 +1482,7 @@ gnc_commodity_table_add_namespace(gnc_commodity_table * table, { ns = g_new0(gnc_commodity_namespace, 1); ns->cm_table = g_hash_table_new(g_str_hash, g_str_equal); - ns->name = gnc_string_cache_insert((gpointer)namespace); + ns->name = CACHE_INSERT((gpointer)namespace); ns->iso4217 = gnc_commodity_namespace_is_iso(namespace); qof_instance_init (&ns->inst, GNC_ID_COMMODITY_NAMESPACE, book); qof_event_gen (&ns->inst.entity, QOF_EVENT_CREATE, NULL); @@ -1539,7 +1539,7 @@ ns_helper(gpointer key, gpointer value, gpointer user_data) { gnc_commodity * c = value; gnc_commodity_destroy(c); - gnc_string_cache_remove(key); /* key is commodity mnemonic */ + CACHE_REMOVE(key); /* key is commodity mnemonic */ return TRUE; } @@ -1564,7 +1564,7 @@ gnc_commodity_table_delete_namespace(gnc_commodity_table * table, g_hash_table_foreach_remove(ns->cm_table, ns_helper, NULL); g_hash_table_destroy(ns->cm_table); - gnc_string_cache_remove(ns->name); + CACHE_REMOVE(ns->name); qof_event_gen (&ns->inst.entity, QOF_EVENT_DESTROY, NULL); qof_instance_release(&ns->inst); diff --git a/src/engine/gnc-engine.c b/src/engine/gnc-engine.c index 1745818d23..29f500bb27 100644 --- a/src/engine/gnc-engine.c +++ b/src/engine/gnc-engine.c @@ -119,11 +119,8 @@ gnc_engine_init(int argc, char ** argv) void gnc_engine_shutdown (void) { - qof_query_shutdown (); - qof_object_shutdown (); - guid_shutdown(); - gnc_engine_string_cache_destroy (); qof_log_shutdown(); + qof_close(); engine_is_initialized = 0; } diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index 312f05aeb9..71edfa38fa 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -67,8 +67,8 @@ gnc_price_destroy (GNCPrice *p) ENTER(" "); qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL); - if(p->type) gnc_string_cache_remove(p->type); - if(p->source) gnc_string_cache_remove(p->source); + if(p->type) CACHE_REMOVE(p->type); + if(p->source) CACHE_REMOVE(p->source); qof_instance_release (&p->inst); memset(p, 0, sizeof(GNCPrice)); @@ -260,8 +260,8 @@ gnc_price_set_source(GNCPrice *p, const char *s) char *tmp; gnc_price_begin_edit (p); - tmp = gnc_string_cache_insert((gpointer) s); - if(p->source) gnc_string_cache_remove(p->source); + tmp = CACHE_INSERT((gpointer) s); + if(p->source) CACHE_REMOVE(p->source); p->source = tmp; gnc_price_set_dirty(p); gnc_price_commit_edit (p); @@ -277,8 +277,8 @@ gnc_price_set_type(GNCPrice *p, const char* type) gchar *tmp; gnc_price_begin_edit (p); - tmp = gnc_string_cache_insert((gpointer) type); - if(p->type) gnc_string_cache_remove(p->type); + tmp = CACHE_INSERT((gpointer) type); + if(p->type) CACHE_REMOVE(p->type); p->type = tmp; gnc_price_set_dirty(p); gnc_price_commit_edit (p); diff --git a/src/engine/kvp-scm.c b/src/engine/kvp-scm.c index 65cf235866..1a90275411 100644 --- a/src/engine/kvp-scm.c +++ b/src/engine/kvp-scm.c @@ -1,6 +1,6 @@ #include "config.h" -#include +#include #include #include #include diff --git a/src/gnome-utils/QuickFill.c b/src/gnome-utils/QuickFill.c index aea9963029..44432f8f69 100644 --- a/src/gnome-utils/QuickFill.c +++ b/src/gnome-utils/QuickFill.c @@ -111,7 +111,7 @@ gnc_quickfill_destroy (QuickFill *qf) qf->matches = NULL; if (qf->text) - gnc_string_cache_remove(qf->text); + CACHE_REMOVE(qf->text); qf->text = NULL; qf->len = 0; @@ -127,7 +127,7 @@ gnc_quickfill_purge (QuickFill *qf) g_hash_table_foreach_remove (qf->matches, destroy_helper, NULL); if (qf->text) - gnc_string_cache_remove (qf->text); + CACHE_REMOVE (qf->text); qf->text = NULL; qf->len = 0; } @@ -302,7 +302,7 @@ quickfill_insert_recursive (QuickFill *qf, const char *text, int depth, /* If there's no string there already, just put the new one in. */ if (old_text == NULL) { - match_qf->text = gnc_string_cache_insert((gpointer) text); + match_qf->text = CACHE_INSERT((gpointer) text); match_qf->len = len; break; } @@ -312,8 +312,8 @@ quickfill_insert_recursive (QuickFill *qf, const char *text, int depth, (strncmp(text, old_text, strlen(old_text)) == 0)) break; - gnc_string_cache_remove(old_text); - match_qf->text = gnc_string_cache_insert((gpointer) text); + CACHE_REMOVE(old_text); + match_qf->text = CACHE_INSERT((gpointer) text); match_qf->len = len; break; }