Revert some qof_instance_get_guid() calls to qof_entity_get_guid().

Those two functions were merged into one, qof_instance_get_guid(), in
r15773, but they returned different values if the parameter was NULL.
Some code depends on the return value being guid_null(), or maybe even
NULL, so revert the changes entity->instance, where the entity is not
guaranteed to be non-NULL.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16212 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2007-06-25 17:18:28 +00:00
parent fa28f0e4f0
commit dcfda18f7c
27 changed files with 53 additions and 36 deletions

View File

@ -709,6 +709,7 @@ reference_list_lookup(gpointer data, gpointer user_data)
ref_param = (QofParam*)data; ref_param = (QofParam*)data;
object_node = params->output_node; object_node = params->output_node;
ent = params->qsf_ent; ent = params->qsf_ent;
g_return_if_fail(ent);
ns = params->qsf_ns; ns = params->qsf_ns;
starter = g_new(QofInstanceReference, 1); starter = g_new(QofInstanceReference, 1);
starter->ent_guid = qof_instance_get_guid(ent); starter->ent_guid = qof_instance_get_guid(ent);
@ -766,6 +767,7 @@ qsf_entity_foreach(QofInstance *ent, gpointer data)
const GUID *cm_guid; const GUID *cm_guid;
gchar cm_sa[GUID_ENCODING_LENGTH + 1]; gchar cm_sa[GUID_ENCODING_LENGTH + 1];
g_return_if_fail(ent != NULL);
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = (qsf_param*)data; params = (qsf_param*)data;
param_count = ++params->count; param_count = ++params->count;

View File

@ -418,7 +418,7 @@ qof_book_get_counter (QofBook *book, const char *counter_name)
gboolean qof_book_register (void) gboolean qof_book_register (void)
{ {
static QofParam params[] = { static QofParam params[] = {
{ QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL }, { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_entity_get_guid, NULL },
{ QOF_PARAM_KVP, QOF_TYPE_KVP, (QofAccessFunc)qof_instance_get_slots, NULL }, { QOF_PARAM_KVP, QOF_TYPE_KVP, (QofAccessFunc)qof_instance_get_slots, NULL },
{ NULL }, { NULL },
}; };

View File

@ -267,7 +267,7 @@ gboolean qof_book_equal (const QofBook *book_1, const QofBook *book_2);
gint64 qof_book_get_counter (QofBook *book, const char *counter_name); gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
/** deprecated */ /** deprecated */
#define qof_book_get_guid(X) qof_instance_get_guid (QOF_INSTANCE(X)) #define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))
#endif /* QOF_BOOK_H */ #endif /* QOF_BOOK_H */
/** @} */ /** @} */

View File

@ -702,6 +702,7 @@ qof_book_merge_commit_rule_loop(QofBookMergeData *mergeData,
g_return_if_fail(rule != NULL); g_return_if_fail(rule != NULL);
g_return_if_fail(mergeData != NULL); g_return_if_fail(mergeData != NULL);
g_return_if_fail(mergeData->targetBook != NULL); g_return_if_fail(mergeData->targetBook != NULL);
g_return_if_fail(rule->importEnt && rule->targetEnt);
g_return_if_fail((rule->mergeResult != MERGE_NEW)||(rule->mergeResult != MERGE_UPDATE)); g_return_if_fail((rule->mergeResult != MERGE_NEW)||(rule->mergeResult != MERGE_UPDATE));
DEBUG ("qof_book_merge_commit_rule_loop rule: type: %s, result: %s, importEnt Type: %s, guid: %s", DEBUG ("qof_book_merge_commit_rule_loop rule: type: %s, result: %s, importEnt Type: %s, guid: %s",

View File

@ -465,6 +465,12 @@ qof_instance_get_guid (gconstpointer inst)
return &(priv->guid); return &(priv->guid);
} }
const GUID *
qof_entity_get_guid (gconstpointer ent)
{
return ent ? qof_instance_get_guid(ent) : guid_null();
}
void void
qof_instance_set_guid (gpointer ptr, const GUID *guid) qof_instance_set_guid (gpointer ptr, const GUID *guid)
{ {

View File

@ -101,6 +101,10 @@ gboolean qof_instance_books_equal (gconstpointer ptr1, gconstpointer ptr2);
/** Return the GUID of this instance */ /** Return the GUID of this instance */
const GUID * qof_instance_get_guid (gconstpointer); const GUID * qof_instance_get_guid (gconstpointer);
/** \deprecated Use qof_instance_get_guid instead.
* Works like qof_instance_get_guid, but returns NULL on NULL */
const GUID * qof_entity_get_guid (gconstpointer);
/** Return the collection this instance belongs to */ /** Return the collection this instance belongs to */
QofCollection* qof_instance_get_collection (gconstpointer inst); QofCollection* qof_instance_get_collection (gconstpointer inst);

View File

@ -1275,7 +1275,7 @@ void qof_query_set_book (QofQuery *q, QofBook *book)
slist = g_slist_prepend (slist, QOF_PARAM_GUID); slist = g_slist_prepend (slist, QOF_PARAM_GUID);
slist = g_slist_prepend (slist, QOF_PARAM_BOOK); slist = g_slist_prepend (slist, QOF_PARAM_BOOK);
qof_query_add_guid_match (q, slist, qof_query_add_guid_match (q, slist,
qof_book_get_guid(book), QOF_QUERY_AND); qof_instance_get_guid(book), QOF_QUERY_AND);
} }
GList * qof_query_get_books (QofQuery *q) GList * qof_query_get_books (QofQuery *q)

View File

@ -1455,8 +1455,7 @@ query_collect_cb(QofInstance* ent, gpointer user_data)
query_coll_t pdata; query_coll_t pdata;
GUID *guid; GUID *guid;
guid = guid_malloc(); guid = (GUID*)qof_entity_get_guid(ent);
guid = (GUID*)qof_instance_get_guid(ent);
pdata = (query_coll_t)user_data; pdata = (query_coll_t)user_data;
pdata->guids = g_list_append(pdata->guids, guid); pdata->guids = g_list_append(pdata->guids, guid);
} }

View File

@ -39,7 +39,7 @@ entity_set_reference_cb(QofInstance *ent, gpointer user_data)
QofBook *partial_book; QofBook *partial_book;
partial_book = (QofBook*)user_data; partial_book = (QofBook*)user_data;
g_return_if_fail(partial_book || ent); g_return_if_fail(partial_book && ent);
reference = NULL; reference = NULL;
coll = NULL; coll = NULL;
book_ref_list = qof_book_get_data(partial_book, ENTITYREFERENCE); book_ref_list = qof_book_get_data(partial_book, ENTITYREFERENCE);
@ -122,6 +122,7 @@ create_reference(QofInstance *ent, const QofParam *param)
char cm_sa[GUID_ENCODING_LENGTH + 1]; char cm_sa[GUID_ENCODING_LENGTH + 1];
gchar *cm_string; gchar *cm_string;
g_return_val_if_fail(ent, NULL);
ref_ent = QOF_INSTANCE(param->param_getfcn(ent, param)); ref_ent = QOF_INSTANCE(param->param_getfcn(ent, param));
if(!ref_ent) { return NULL; } if(!ref_ent) { return NULL; }
reference = g_new0(QofInstanceReference, 1); reference = g_new0(QofInstanceReference, 1);

View File

@ -368,15 +368,17 @@ col_ref_cb (QofInstance* ref_ent, gpointer user_data)
char cm_sa[GUID_ENCODING_LENGTH + 1]; char cm_sa[GUID_ENCODING_LENGTH + 1];
gchar *cm_string; gchar *cm_string;
g_return_if_fail(user_data);
qecd = (QofInstanceCopyData*)user_data; qecd = (QofInstanceCopyData*)user_data;
ent = qecd->from; ent = qecd->from;
g_return_if_fail(ent);
ref = g_new0(QofInstanceReference, 1); ref = g_new0(QofInstanceReference, 1);
ref->type = ent->e_type; ref->type = ent->e_type;
ref->ref_guid = g_new(GUID, 1); ref->ref_guid = g_new(GUID, 1);
ref->ent_guid = qof_instance_get_guid(ent); ref->ent_guid = qof_instance_get_guid(ent);
ref->param = qof_class_get_parameter(ent->e_type, ref->param = qof_class_get_parameter(ent->e_type,
qecd->param->param_name); qecd->param->param_name);
cm_guid = qof_instance_get_guid(ref_ent); cm_guid = qof_entity_get_guid(ref_ent);
guid_to_string_buff(cm_guid, cm_sa); guid_to_string_buff(cm_guid, cm_sa);
cm_string = g_strdup(cm_sa); cm_string = g_strdup(cm_sa);
if(TRUE == string_to_guid(cm_string, ref->ref_guid)) { if(TRUE == string_to_guid(cm_string, ref->ref_guid)) {
@ -594,7 +596,8 @@ qof_instance_coll_foreach(QofInstance *original, gpointer user_data)
QofBook *targetBook; QofBook *targetBook;
QofCollection *coll; QofCollection *coll;
QofInstance *copy; QofInstance *copy;
g_return_if_fail(original != NULL);
g_return_if_fail(user_data != NULL); g_return_if_fail(user_data != NULL);
copy = NULL; copy = NULL;
qecd = (QofInstanceCopyData*)user_data; qecd = (QofInstanceCopyData*)user_data;
@ -612,7 +615,8 @@ qof_instance_coll_copy(QofInstance *original, gpointer user_data)
QofBook *book; QofBook *book;
QofInstance *inst; QofInstance *inst;
const GUID *g; const GUID *g;
g_return_if_fail(original != NULL);
g_return_if_fail(user_data != NULL); g_return_if_fail(user_data != NULL);
qecd = (QofInstanceCopyData*)user_data; qecd = (QofInstanceCopyData*)user_data;
book = qof_session_get_book(qecd->new_session); book = qof_session_get_book(qecd->new_session);

View File

@ -258,7 +258,7 @@ gnc_cm_event_handler (QofInstance *entity,
gpointer user_data, gpointer user_data,
gpointer event_data) gpointer event_data)
{ {
const GUID *guid = qof_instance_get_guid(entity); const GUID *guid = qof_entity_get_guid(entity);
#if CM_DEBUG #if CM_DEBUG
fprintf (stderr, "event_handler: event %d, entity %p, guid %s\n", event_type, fprintf (stderr, "event_handler: event %d, entity %p, guid %s\n", event_type,
entity, guid); entity, guid);

View File

@ -208,7 +208,7 @@ get_book_cb (PGBackend *be, PGresult *result, int j, gpointer data)
for (node=blist; node; node=node->next) for (node=blist; node; node=node->next)
{ {
book = node->data; book = node->data;
if (guid_equal (qof_instance_get_guid(QOF_INSTANCE(book)), &guid)) break; if (guid_equal (qof_entity_get_guid(QOF_INSTANCE(book)), &guid)) break;
book = NULL; book = NULL;
} }

View File

@ -358,7 +358,7 @@ int finishQuery(PGBackend *be);
for (node=be->blist; node; node=node->next) \ for (node=be->blist; node; node=node->next) \
{ \ { \
book = node->data; \ book = node->data; \
if (guid_equal (qof_instance_get_guid((QofInstance*)book), &book_guid)) break; \ if (guid_equal (qof_entity_get_guid((QofInstance*)book), &book_guid)) break; \
book = NULL; \ book = NULL; \
} \ } \
if (!book) return data; \ if (!book) return data; \

View File

@ -13,7 +13,7 @@ define(`account', `gncAccount, Account, Account, a,
commodity, , char *, gnc_commodity_get_unique_name(xaccAccountGetCommodity(ptr)), commodity, , char *, gnc_commodity_get_unique_name(xaccAccountGetCommodity(ptr)),
version, , int32, qof_instance_get_version(ptr), version, , int32, qof_instance_get_version(ptr),
iguid, , int32, qof_instance_get_idata(ptr), iguid, , int32, qof_instance_get_idata(ptr),
bookGUID, , GUID *, qof_instance_get_guid((QofInstance*)gnc_account_get_book(ptr)), bookGUID, , GUID *, qof_entity_get_guid((QofInstance*)gnc_account_get_book(ptr)),
parentGUID, , GUID *, xaccAccountGetGUID(gnc_account_get_parent(ptr)), parentGUID, , GUID *, xaccAccountGetGUID(gnc_account_get_parent(ptr)),
accountGUID, KEY, GUID *, xaccAccountGetGUID(ptr), accountGUID, KEY, GUID *, xaccAccountGetGUID(ptr),
') ')
@ -362,7 +362,7 @@ define(`compare_version',
p = be->buff; *p = 0; p = be->buff; *p = 0;
p = stpcpy (p, "SELECT version FROM tablename($@) WHERE key_fieldname($@) = ''`"); p = stpcpy (p, "SELECT version FROM tablename($@) WHERE key_fieldname($@) = ''`");
p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p); p = guid_to_string_buff (qof_entity_get_guid(QOF_INSTANCE(ptr)), p);
p = stpcpy (p, "''`;"); p = stpcpy (p, "''`;");
SEND_QUERY (be,be->buff, -1); SEND_QUERY (be,be->buff, -1);
sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1)); sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));
@ -392,7 +392,7 @@ define(`is_deleted',
p = be->buff; *p = 0; p = be->buff; *p = 0;
p = stpcpy (p, "SELECT version FROM tablename($@)" "Trail WHERE key_fieldname($@) = ''`"); p = stpcpy (p, "SELECT version FROM tablename($@)" "Trail WHERE key_fieldname($@) = ''`");
p = guid_to_string_buff (qof_instance_get_guid(QOF_INSTANCE(ptr)), p); p = guid_to_string_buff (qof_entity_get_guid(QOF_INSTANCE(ptr)), p);
p = stpcpy (p, "''` AND change = ''`d''`;"); p = stpcpy (p, "''` AND change = ''`d''`;");
SEND_QUERY (be,be->buff, -1); SEND_QUERY (be,be->buff, -1);
sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1)); sql_version = GPOINTER_TO_INT(pgendGetResults (be, get_version_cb, (gpointer) -1));

View File

@ -114,9 +114,9 @@ gboolean gncEmployeeIsDirty (GncEmployee *employee);
#define EMPLOYEE_CC "credit_card_account" #define EMPLOYEE_CC "credit_card_account"
/** deprecated routines */ /** deprecated routines */
#define gncEmployeeGetGUID(E) qof_instance_get_guid(QOF_INSTANCE(E)) #define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E))
#define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E)) #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
#define gncEmployeeRetGUID(E) (E ? *(qof_instance_get_guid(QOF_INSTANCE(E))) : *(guid_null())) #define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
#define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G)) #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
#endif /* GNC_EMPLOYEE_H_ */ #endif /* GNC_EMPLOYEE_H_ */

View File

@ -232,8 +232,8 @@ Account *gnc_book_get_root_account(QofBook *book);
void gnc_book_set_root_account(QofBook *book, Account *root); void gnc_book_set_root_account(QofBook *book, Account *root);
/** @deprecated */ /** @deprecated */
#define xaccAccountGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define xaccAccountGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
#define xaccAccountReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null())) #define xaccAccountReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
/** The xaccAccountLookup() subroutine will return the /** The xaccAccountLookup() subroutine will return the
* account associated with the given id, or NULL * account associated with the given id, or NULL

View File

@ -318,7 +318,7 @@ gboolean SXRegister (void);
/** \deprecated */ /** \deprecated */
#define xaccSchedXactionIsDirty(X) qof_instance_is_dirty (QOF_INSTANCE(X)) #define xaccSchedXactionIsDirty(X) qof_instance_is_dirty (QOF_INSTANCE(X))
/** \deprecated */ /** \deprecated */
#define xaccSchedXactionGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define xaccSchedXactionGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
/** \deprecated */ /** \deprecated */
#define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X)) #define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))

View File

@ -1814,7 +1814,7 @@ gboolean xaccSplitRegister (void)
{ "d-share-amount", QOF_TYPE_DOUBLE, { "d-share-amount", QOF_TYPE_DOUBLE,
(QofAccessFunc)DxaccSplitGetShareAmount, NULL }, (QofAccessFunc)DxaccSplitGetShareAmount, NULL },
{ "d-share-int64", QOF_TYPE_INT64, { "d-share-int64", QOF_TYPE_INT64,
(QofAccessFunc)qof_instance_get_guid, NULL }, (QofAccessFunc)qof_entity_get_guid, NULL },
{ SPLIT_BALANCE, QOF_TYPE_NUMERIC, { SPLIT_BALANCE, QOF_TYPE_NUMERIC,
(QofAccessFunc)xaccSplitGetBalance, NULL }, (QofAccessFunc)xaccSplitGetBalance, NULL },
{ SPLIT_CLEARED_BALANCE, QOF_TYPE_NUMERIC, { SPLIT_CLEARED_BALANCE, QOF_TYPE_NUMERIC,
@ -1855,7 +1855,7 @@ gboolean xaccSplitRegister (void)
{ SPLIT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccSplitGetSlots, NULL }, { SPLIT_KVP, QOF_TYPE_KVP, (QofAccessFunc)xaccSplitGetSlots, NULL },
{ QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccSplitGetBook, NULL }, { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)xaccSplitGetBook, NULL },
{ QOF_PARAM_GUID, QOF_TYPE_GUID, { QOF_PARAM_GUID, QOF_TYPE_GUID,
(QofAccessFunc)qof_instance_get_guid, NULL }, (QofAccessFunc)qof_entity_get_guid, NULL },
{ NULL }, { NULL },
}; };

View File

@ -500,9 +500,9 @@ gnc_numeric xaccSplitVoidFormerValue(const Split *split);
/** @} */ /** @} */
/** \deprecated */ /** \deprecated */
#define xaccSplitGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define xaccSplitGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
/** \deprecated */ /** \deprecated */
#define xaccSplitReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null())) #define xaccSplitReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
#endif /* XACC_SPLIT_H */ #endif /* XACC_SPLIT_H */
/** @} */ /** @} */

View File

@ -1971,7 +1971,7 @@ gboolean xaccTransRegister (void)
{ QOF_PARAM_BOOK, QOF_ID_BOOK, { QOF_PARAM_BOOK, QOF_ID_BOOK,
(QofAccessFunc)qof_instance_get_book, NULL }, (QofAccessFunc)qof_instance_get_book, NULL },
{ QOF_PARAM_GUID, QOF_TYPE_GUID, { QOF_PARAM_GUID, QOF_TYPE_GUID,
(QofAccessFunc)qof_instance_get_guid, NULL }, (QofAccessFunc)qof_entity_get_guid, NULL },
{ NULL }, { NULL },
}; };

View File

@ -567,9 +567,9 @@ Timespec xaccTransGetVoidTime(const Transaction *tr);
/** \deprecated */ /** \deprecated */
#define xaccTransGetBook(X) qof_instance_get_book (QOF_INSTANCE(X)) #define xaccTransGetBook(X) qof_instance_get_book (QOF_INSTANCE(X))
/** \deprecated */ /** \deprecated */
#define xaccTransGetGUID(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define xaccTransGetGUID(X) qof_entity_get_guid(QOF_INSTANCE(X))
/** \deprecated */ /** \deprecated */
#define xaccTransReturnGUID(X) (X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null())) #define xaccTransReturnGUID(X) (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
/** \deprecated */ /** \deprecated */
#define xaccTransGetSlots(X) qof_instance_get_slots (QOF_INSTANCE(X)) #define xaccTransGetSlots(X) qof_instance_get_slots (QOF_INSTANCE(X))

View File

@ -105,7 +105,7 @@ void gnc_budget_commit_edit(GncBudget *bgt);
const GUID* gnc_budget_get_guid(GncBudget* budget); const GUID* gnc_budget_get_guid(GncBudget* budget);
#define gnc_budget_return_guid(X) \ #define gnc_budget_return_guid(X) \
(X ? *(qof_instance_get_guid(QOF_INSTANCE(X))) : *(guid_null())) (X ? *(qof_entity_get_guid(QOF_INSTANCE(X))) : *(guid_null()))
/** Set/Get the name of the Budget */ /** Set/Get the name of the Budget */
void gnc_budget_set_name(GncBudget* budget, const gchar* name); void gnc_budget_set_name(GncBudget* budget, const gchar* name);

View File

@ -440,7 +440,7 @@ gboolean gnc_lot_register (void)
(QofAccessFunc) gnc_lot_get_notes, (QofAccessFunc) gnc_lot_get_notes,
(QofSetterFunc) gnc_lot_set_notes }, (QofSetterFunc) gnc_lot_set_notes },
{ QOF_PARAM_GUID, QOF_TYPE_GUID, { QOF_PARAM_GUID, QOF_TYPE_GUID,
(QofAccessFunc) qof_instance_get_guid, NULL }, (QofAccessFunc) qof_entity_get_guid, NULL },
{ QOF_PARAM_BOOK, QOF_ID_BOOK, { QOF_PARAM_BOOK, QOF_ID_BOOK,
(QofAccessFunc) gnc_lot_get_book, NULL }, (QofAccessFunc) gnc_lot_get_book, NULL },
{ LOT_IS_CLOSED, QOF_TYPE_BOOLEAN, { LOT_IS_CLOSED, QOF_TYPE_BOOLEAN,

View File

@ -156,7 +156,7 @@ void gnc_lot_set_notes (GNCLot *, const char *);
* */ * */
KvpFrame * gnc_lot_get_slots (const GNCLot *); KvpFrame * gnc_lot_get_slots (const GNCLot *);
#define gnc_lot_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define gnc_lot_get_guid(X) qof_entity_get_guid(QOF_INSTANCE(X))
#define LOT_IS_CLOSED "is-closed?" #define LOT_IS_CLOSED "is-closed?"
#define LOT_BALANCE "balance" #define LOT_BALANCE "balance"

View File

@ -227,8 +227,8 @@ const char * gnc_price_get_typestr(const GNCPrice *p);
gnc_numeric gnc_price_get_value(const GNCPrice *p); gnc_numeric gnc_price_get_value(const GNCPrice *p);
gboolean gnc_price_equal(const GNCPrice *p1, const GNCPrice *p2); gboolean gnc_price_equal(const GNCPrice *p1, const GNCPrice *p2);
#define gnc_price_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X)) #define gnc_price_get_guid(X) qof_entity_get_guid(QOF_INSTANCE(X))
#define gnc_price_return_guid(X) (*(qof_instance_get_guid(QOF_INSTANCE(X)))) #define gnc_price_return_guid(X) (*(qof_entity_get_guid(QOF_INSTANCE(X))))
#define gnc_price_get_book(X) qof_instance_get_book(QOF_INSTANCE(X)) #define gnc_price_get_book(X) qof_instance_get_book(QOF_INSTANCE(X))
/** @} */ /** @} */

View File

@ -75,7 +75,7 @@ chart_collection_cb(QofInstance *ent, gpointer user_data)
{ {
success = qof_instance_copy_to_session(data->chart_session, ent); success = qof_instance_copy_to_session(data->chart_session, ent);
if(!success) { return; } if(!success) { return; }
guid = qof_instance_get_guid(ent); guid = qof_entity_get_guid(ent);
book = qof_session_get_book(data->chart_session); book = qof_session_get_book(data->chart_session);
copy_coll = qof_book_get_collection(book, GNC_ID_ACCOUNT); copy_coll = qof_book_get_collection(book, GNC_ID_ACCOUNT);
data->equity_account = (Account*)qof_collection_lookup_entity(copy_coll, guid); data->equity_account = (Account*)qof_collection_lookup_entity(copy_coll, guid);
@ -119,7 +119,7 @@ chart_entity_cb(QofInstance *ent, gpointer user_data)
data = (chart_data*)user_data; data = (chart_data*)user_data;
trans_time = data->chart_time_t; trans_time = data->chart_time_t;
data->param_ref_list = NULL; data->param_ref_list = NULL;
guid = qof_instance_get_guid(ent); guid = qof_entity_get_guid(ent);
acc_ent = (Account*)ent; acc_ent = (Account*)ent;
ref = NULL; ref = NULL;
equity_account = data->equity_account; equity_account = data->equity_account;

View File

@ -230,7 +230,7 @@ gnc_restore_all_state (gpointer session, gpointer unused)
/* Get the book GUID */ /* Get the book GUID */
book = qof_session_get_book(session); book = qof_session_get_book(session);
guid = qof_instance_get_guid(QOF_INSTANCE(book)); guid = qof_entity_get_guid(QOF_INSTANCE(book));
guid_string = guid_to_string(guid); guid_string = guid_to_string(guid);
keyfile = gnc_find_state_file(url, guid_string, &filename); keyfile = gnc_find_state_file(url, guid_string, &filename);
@ -317,7 +317,7 @@ gnc_save_all_state (gpointer session, gpointer unused)
/* Get the book GUID */ /* Get the book GUID */
book = qof_session_get_book(session); book = qof_session_get_book(session);
guid = qof_instance_get_guid(QOF_INSTANCE(book)); guid = qof_entity_get_guid(QOF_INSTANCE(book));
guid_string = guid_to_string(guid); guid_string = guid_to_string(guid);
/* Find the filename to use. This returns the data from the /* Find the filename to use. This returns the data from the