From c9e8127c2bd0a9c6431acf598c2a3100607d7c5d Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Mon, 2 Feb 1998 02:13:58 +0000 Subject: [PATCH] rename transaction method names git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@487 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/AccWindow.c | 5 ++--- src/Account.c | 6 +++--- src/AdjBWindow.c | 2 +- src/FileIO.c | 28 ++++++++++++++-------------- src/QIFIO.c | 4 ++-- src/Transaction.c | 11 ++++++----- src/XferWindow.c | 5 ++++- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/AccWindow.c b/src/AccWindow.c index 373677f1e2..690d43a6d3 100644 --- a/src/AccWindow.c +++ b/src/AccWindow.c @@ -671,9 +671,8 @@ createCB( Widget mw, XtPointer cd, XtPointer cb ) } /* Add an opening balance transaction (as the first transaction) */ - trans = mallocTransaction(); - initTransaction(trans); - + trans = xaccMallocTransaction(); + todaysDate( &(trans->date) ); xaccTransSetDescription (trans, OPEN_BALN_STR); diff --git a/src/Account.c b/src/Account.c index fe0141e77e..80ed556b45 100644 --- a/src/Account.c +++ b/src/Account.c @@ -123,7 +123,7 @@ freeAccount( Account *acc ) } if ( (!dont_free_transaction) && (NULL == trans->credit_split.acc) ) { - freeTransaction( trans ); + xaccFreeTransaction( trans ); } i++; @@ -531,11 +531,11 @@ xaccConsolidateTransactions (Account * acc) if (0 == DEQ(sa->share_price, sb->share_price)) continue; if (strcmp (sa->memo, sb->memo)) continue; -#ifdef STIL_BROKEN +#ifdef STILL_BROKEN /* hack alert -- still broken from splits */ /* Free the transaction, and shuffle down by one. * Need to shuffle in order to preserve date ordering. */ - freeTransaction (tb); + xaccFreeTransaction (tb); for (k=j+1; knumTrans; k++) { acc->transaction[k-1] = acc->transaction[k]; diff --git a/src/AdjBWindow.c b/src/AdjBWindow.c index 6f376b3f4e..e599c3c50d 100644 --- a/src/AdjBWindow.c +++ b/src/AdjBWindow.c @@ -297,7 +297,7 @@ adjBOkCB( Widget mw, XtPointer cd, XtPointer cb ) acc->parent->saved = False; /* allocate mem for the new transaction */ - trans = mallocTransaction(); + trans = xaccMallocTransaction(); /* Create the "trans" transaction */ str = XmTextGetString(adjBData->date); diff --git a/src/FileIO.c b/src/FileIO.c index d4381ba2bb..9473ae61fd 100644 --- a/src/FileIO.c +++ b/src/FileIO.c @@ -496,7 +496,7 @@ readTransaction( int fd, Account *acc, int token ) double share_price = 0.0; /* create a transaction structure */ - trans = mallocTransaction(); + trans = xaccMallocTransaction(); ENTER ("readTransaction"); @@ -504,7 +504,7 @@ readTransaction( int fd, Account *acc, int token ) if( trans->num == NULL ) { PERR ("Premature end of Transaction at num"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } @@ -512,7 +512,7 @@ readTransaction( int fd, Account *acc, int token ) if( date == NULL ) { PERR ("Premature end of Transaction at date"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } trans->date = *date; @@ -522,7 +522,7 @@ readTransaction( int fd, Account *acc, int token ) if( trans->description == NULL ) { PERR ("Premature end of Transaction at description"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } @@ -535,7 +535,7 @@ readTransaction( int fd, Account *acc, int token ) if( NULL == tmp ) { PERR ("Premature end of Transaction at memo"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } xaccTransSetMemo (trans, tmp); @@ -547,7 +547,7 @@ readTransaction( int fd, Account *acc, int token ) if( tmp == NULL ) { PERR ("Premature end of Transaction at action"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } xaccTransSetAction (trans, tmp); @@ -558,7 +558,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(int) ) { PERR ("Premature end of Transaction at catagory"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } @@ -566,7 +566,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(char) ) { PERR ("Premature end of Transaction at reconciled"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } xaccTransSetReconcile (trans, recn); @@ -602,7 +602,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(int) ) { PERR ("Premature end of Transaction at V1 amount"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_INT (amount); @@ -616,7 +616,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(double) ) { PERR ("Premature end of Transaction at amount"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_DOUBLE (damount); @@ -628,7 +628,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(double) ) { PERR ("Premature end of Transaction at share_price"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_DOUBLE (damount); @@ -647,7 +647,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(int) ) { PERR ("Premature end of Transaction at credit"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_INT (acc_id); @@ -664,7 +664,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(int) ) { PERR ("Premature end of Transaction at debit"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_INT (acc_id); @@ -711,7 +711,7 @@ readTransaction( int fd, Account *acc, int token ) if( err != sizeof(int) ) { PERR ("Premature end of Transaction at num-splits"); - freeTransaction(trans); + xaccFreeTransaction(trans); return NULL; } XACC_FLIP_INT (numSplits); diff --git a/src/QIFIO.c b/src/QIFIO.c index 7ef43ccb63..2d5d5fd9a9 100644 --- a/src/QIFIO.c +++ b/src/QIFIO.c @@ -605,7 +605,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc) if (!qifline) return NULL; if ('!' == qifline [0]) return qifline; - trans = mallocTransaction (); + trans = xaccMallocTransaction (); /* scan for transaction date, description, type */ while (qifline) { @@ -769,7 +769,7 @@ char * xaccReadQIFTransaction (int fd, Account *acc) * if we see something else, assume the worst, free the last * transaction, and return */ if ('!' == qifline[0]) { - freeTransaction (trans); + xaccFreeTransaction (trans); return qifline; } diff --git a/src/Transaction.c b/src/Transaction.c index e399d77245..7db2e84e68 100644 --- a/src/Transaction.c +++ b/src/Transaction.c @@ -163,12 +163,12 @@ double xaccGetShareBalance (Split *s) } /********************************************************************\ - * initTransaction + * xaccInitTransaction * Initialize a transaction structure \********************************************************************/ void -initTransaction( Transaction * trans ) +xaccInitTransaction( Transaction * trans ) { /* fill in some sane defaults */ @@ -188,11 +188,12 @@ initTransaction( Transaction * trans ) /********************************************************************\ \********************************************************************/ + Transaction * -mallocTransaction( void ) +xaccMallocTransaction( void ) { Transaction *trans = (Transaction *)_malloc(sizeof(Transaction)); - initTransaction (trans); + xaccInitTransaction (trans); return trans; } @@ -200,7 +201,7 @@ mallocTransaction( void ) \********************************************************************/ void -freeTransaction( Transaction *trans ) +xaccFreeTransaction( Transaction *trans ) { int i; Split *s; diff --git a/src/XferWindow.c b/src/XferWindow.c index 6a8b985f67..c6c50e5642 100644 --- a/src/XferWindow.c +++ b/src/XferWindow.c @@ -458,7 +458,7 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb ) grp->saved = False; /* a double-entry transfer -- just one record, two accounts */ - trans = mallocTransaction(); + trans = xaccMallocTransaction(); split = xaccMallocSplit(); xaccTransAppendSplit (trans, split); @@ -474,6 +474,9 @@ xferCB( Widget mw, XtPointer cd, XtPointer cb ) xaccTransSetMemo (trans, XmTextGetString(xferData->memo)); xaccTransSetDescription (trans, XmTextGetString(xferData->desc)); xaccTransSetReconcile (trans, NREC); + + /* make sure that all monetary sums are up-to-date */ + xaccTransRecomputeAmount (trans); /* make note of which accounts this was transfered from & to */ acc = getAccount(grp,xferData->from);