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 <qof.h> instead of <kvp_frame.h>
	* 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
This commit is contained in:
Derek Atkins
2006-04-10 22:20:12 +00:00
parent f9d1f3e42f
commit 422bf34bfe
9 changed files with 43 additions and 30 deletions

View File

@@ -18,6 +18,20 @@
Keep the deprecated GNC_SCANF_LLD defined in terms of the new Keep the deprecated GNC_SCANF_LLD defined in terms of the new
QOF_SCANF_LLD. 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 <qof.h> instead of <kvp_frame.h>
* src/engine/gnc-engine.c:
Update the method used to shutdown QOF.
2006-04-08 David Hampton <hampton@employees.org> 2006-04-08 David Hampton <hampton@employees.org>
* src/gnome-utils/account-quickfill.c: Eliminate some unnecessary * src/gnome-utils/account-quickfill.c: Eliminate some unnecessary

View File

@@ -220,7 +220,7 @@ string_to_gint64(const gchar *str, gint64 *v)
g_return_val_if_fail(str, FALSE); g_return_val_if_fail(str, FALSE);
/* must use "<" here because %n's effects aren't well defined */ /* 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); return(FALSE);
} }

View File

@@ -999,7 +999,9 @@ xaccAccountOrder (const Account **aa, const Account **ab)
} }
/* Otherwise do a string sort */ /* 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 */ /* if acccount-type-order array not initialized, initialize it */
/* this will happen at most once during program invocation */ /* this will happen at most once during program invocation */

View File

@@ -242,8 +242,8 @@ xaccInitTransaction (Transaction * trans, QofBook *book)
{ {
ENTER ("trans=%p", trans); ENTER ("trans=%p", trans);
/* Fill in some sane defaults */ /* Fill in some sane defaults */
trans->num = gnc_string_cache_insert(""); trans->num = CACHE_INSERT("");
trans->description = gnc_string_cache_insert(""); trans->description = CACHE_INSERT("");
trans->common_currency = NULL; trans->common_currency = NULL;
trans->splits = NULL; trans->splits = NULL;
@@ -358,8 +358,8 @@ xaccDupeTransaction (const Transaction *t)
trans = g_new0 (Transaction, 1); trans = g_new0 (Transaction, 1);
trans->num = gnc_string_cache_insert (t->num); trans->num = CACHE_INSERT (t->num);
trans->description = gnc_string_cache_insert (t->description); trans->description = CACHE_INSERT (t->description);
trans->splits = g_list_copy (t->splits); trans->splits = g_list_copy (t->splits);
for (node = trans->splits; node; node = node->next) for (node = trans->splits; node; node = node->next)
@@ -405,8 +405,8 @@ xaccTransClone (const Transaction *t)
trans->date_entered = t->date_entered; trans->date_entered = t->date_entered;
trans->date_posted = t->date_posted; trans->date_posted = t->date_posted;
trans->num = gnc_string_cache_insert (t->num); trans->num = CACHE_INSERT (t->num);
trans->description = gnc_string_cache_insert (t->description); trans->description = CACHE_INSERT (t->description);
trans->common_currency = t->common_currency; trans->common_currency = t->common_currency;
trans->version = t->version; trans->version = t->version;
trans->version_check = t->version_check; trans->version_check = t->version_check;
@@ -458,8 +458,8 @@ xaccFreeTransaction (Transaction *trans)
trans->splits = NULL; trans->splits = NULL;
/* free up transaction strings */ /* free up transaction strings */
gnc_string_cache_remove(trans->num); CACHE_REMOVE(trans->num);
gnc_string_cache_remove(trans->description); CACHE_REMOVE(trans->description);
/* Just in case someone looks up freed memory ... */ /* Just in case someone looks up freed memory ... */
trans->num = (char *) 1; trans->num = (char *) 1;

View File

@@ -1239,7 +1239,7 @@ gnc_commodity_table_insert(gnc_commodity_table * table,
PINFO ("insert %p %s into nsp=%p %s", comm->mnemonic, comm->mnemonic, PINFO ("insert %p %s into nsp=%p %s", comm->mnemonic, comm->mnemonic,
nsp->cm_table, nsp->name); nsp->cm_table, nsp->name);
g_hash_table_insert(nsp->cm_table, g_hash_table_insert(nsp->cm_table,
gnc_string_cache_insert(comm->mnemonic), CACHE_INSERT(comm->mnemonic),
(gpointer)comm); (gpointer)comm);
nsp->cm_list = g_list_append(nsp->cm_list, 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 = g_new0(gnc_commodity_namespace, 1);
ns->cm_table = g_hash_table_new(g_str_hash, g_str_equal); 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); ns->iso4217 = gnc_commodity_namespace_is_iso(namespace);
qof_instance_init (&ns->inst, GNC_ID_COMMODITY_NAMESPACE, book); qof_instance_init (&ns->inst, GNC_ID_COMMODITY_NAMESPACE, book);
qof_event_gen (&ns->inst.entity, QOF_EVENT_CREATE, NULL); 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 * c = value;
gnc_commodity_destroy(c); gnc_commodity_destroy(c);
gnc_string_cache_remove(key); /* key is commodity mnemonic */ CACHE_REMOVE(key); /* key is commodity mnemonic */
return TRUE; 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_foreach_remove(ns->cm_table, ns_helper, NULL);
g_hash_table_destroy(ns->cm_table); 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_event_gen (&ns->inst.entity, QOF_EVENT_DESTROY, NULL);
qof_instance_release(&ns->inst); qof_instance_release(&ns->inst);

View File

@@ -119,11 +119,8 @@ gnc_engine_init(int argc, char ** argv)
void void
gnc_engine_shutdown (void) gnc_engine_shutdown (void)
{ {
qof_query_shutdown ();
qof_object_shutdown ();
guid_shutdown();
gnc_engine_string_cache_destroy ();
qof_log_shutdown(); qof_log_shutdown();
qof_close();
engine_is_initialized = 0; engine_is_initialized = 0;
} }

View File

@@ -67,8 +67,8 @@ gnc_price_destroy (GNCPrice *p)
ENTER(" "); ENTER(" ");
qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL); qof_event_gen (&p->inst.entity, QOF_EVENT_DESTROY, NULL);
if(p->type) gnc_string_cache_remove(p->type); if(p->type) CACHE_REMOVE(p->type);
if(p->source) gnc_string_cache_remove(p->source); if(p->source) CACHE_REMOVE(p->source);
qof_instance_release (&p->inst); qof_instance_release (&p->inst);
memset(p, 0, sizeof(GNCPrice)); memset(p, 0, sizeof(GNCPrice));
@@ -260,8 +260,8 @@ gnc_price_set_source(GNCPrice *p, const char *s)
char *tmp; char *tmp;
gnc_price_begin_edit (p); gnc_price_begin_edit (p);
tmp = gnc_string_cache_insert((gpointer) s); tmp = CACHE_INSERT((gpointer) s);
if(p->source) gnc_string_cache_remove(p->source); if(p->source) CACHE_REMOVE(p->source);
p->source = tmp; p->source = tmp;
gnc_price_set_dirty(p); gnc_price_set_dirty(p);
gnc_price_commit_edit (p); gnc_price_commit_edit (p);
@@ -277,8 +277,8 @@ gnc_price_set_type(GNCPrice *p, const char* type)
gchar *tmp; gchar *tmp;
gnc_price_begin_edit (p); gnc_price_begin_edit (p);
tmp = gnc_string_cache_insert((gpointer) type); tmp = CACHE_INSERT((gpointer) type);
if(p->type) gnc_string_cache_remove(p->type); if(p->type) CACHE_REMOVE(p->type);
p->type = tmp; p->type = tmp;
gnc_price_set_dirty(p); gnc_price_set_dirty(p);
gnc_price_commit_edit (p); gnc_price_commit_edit (p);

View File

@@ -1,6 +1,6 @@
#include "config.h" #include "config.h"
#include <kvp_frame.h> #include <qof.h>
#include <g-wrap-wct.h> #include <g-wrap-wct.h>
#include <libguile.h> #include <libguile.h>
#include <engine-helpers.h> #include <engine-helpers.h>

View File

@@ -111,7 +111,7 @@ gnc_quickfill_destroy (QuickFill *qf)
qf->matches = NULL; qf->matches = NULL;
if (qf->text) if (qf->text)
gnc_string_cache_remove(qf->text); CACHE_REMOVE(qf->text);
qf->text = NULL; qf->text = NULL;
qf->len = 0; qf->len = 0;
@@ -127,7 +127,7 @@ gnc_quickfill_purge (QuickFill *qf)
g_hash_table_foreach_remove (qf->matches, destroy_helper, NULL); g_hash_table_foreach_remove (qf->matches, destroy_helper, NULL);
if (qf->text) if (qf->text)
gnc_string_cache_remove (qf->text); CACHE_REMOVE (qf->text);
qf->text = NULL; qf->text = NULL;
qf->len = 0; 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 there's no string there already, just put the new one in. */
if (old_text == NULL) if (old_text == NULL)
{ {
match_qf->text = gnc_string_cache_insert((gpointer) text); match_qf->text = CACHE_INSERT((gpointer) text);
match_qf->len = len; match_qf->len = len;
break; break;
} }
@@ -312,8 +312,8 @@ quickfill_insert_recursive (QuickFill *qf, const char *text, int depth,
(strncmp(text, old_text, strlen(old_text)) == 0)) (strncmp(text, old_text, strlen(old_text)) == 0))
break; break;
gnc_string_cache_remove(old_text); CACHE_REMOVE(old_text);
match_qf->text = gnc_string_cache_insert((gpointer) text); match_qf->text = CACHE_INSERT((gpointer) text);
match_qf->len = len; match_qf->len = len;
break; break;
} }