add a utility routine

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1096 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-09-05 07:36:28 +00:00
parent 7eea03c6f1
commit 1e10ba84e2
2 changed files with 23 additions and 3 deletions

View File

@ -1142,5 +1142,19 @@ xaccGetOtherSplit (Split *split)
return NULL; /* never reached, in theory */ return NULL; /* never reached, in theory */
} }
/********************************************************************\
\********************************************************************/
int
xaccIsPeerSplit (Split *sa, Split *sb)
{
Transaction *ta, *tb;
if (!sa || !sb) return 0;
ta = sa->parent;
tb = sb->parent;
if (ta == tb) return 1;
return 0;
}
/************************ END OF ************************************\ /************************ END OF ************************************\
\************************* FILE *************************************/ \************************* FILE *************************************/

View File

@ -210,7 +210,7 @@ double xaccSplitGetClearedBalance (Split *);
double xaccSplitGetReconciledBalance (Split *); double xaccSplitGetReconciledBalance (Split *);
double xaccSplitGetShareBalance (Split *); double xaccSplitGetShareBalance (Split *);
/* return teh parent transaction of the split */ /* return the parent transaction of the split */
Transaction * xaccSplitGetParent (Split *); Transaction * xaccSplitGetParent (Split *);
/* return the memo, action strings */ /* return the memo, action strings */
@ -257,9 +257,15 @@ Account * xaccGetAccountByName (Transaction *, const char *);
/* /*
* The GetOtherSplit() is a convenience routine that returns * The GetOtherSplit() is a convenience routine that returns
* the other of a pair of splits. If there are more than two * the other of a pair of splits. If there are more than two
* splits, it returns NULL. * splits, it returns NULL.
*/ */
Split * xaccGetOtherSplit (Split *); Split * xaccGetOtherSplit (Split *);
/* The IsPeerSplit() is a convenience routine that returns
* a non-zero value if the two splits share a common
* parent transaction, else it returns zero.
*/
int xaccIsPeerSplit (Split *, Split *);
#endif /* __XACC_TRANSACTION_H__ */ #endif /* __XACC_TRANSACTION_H__ */