r22382 - gnucash/trunk/src/engine - Add xaccTransDump back, it is very useful when debugging.

Mike Alexander mta at code.gnucash.org
Mon Sep 10 23:29:39 EDT 2012


Author: mta
Date: 2012-09-10 23:29:39 -0400 (Mon, 10 Sep 2012)
New Revision: 22382
Trac: http://svn.gnucash.org/trac/changeset/22382

Modified:
   gnucash/trunk/src/engine/Transaction.c
   gnucash/trunk/src/engine/Transaction.h
Log:
Add xaccTransDump back, it is very useful when debugging.
It was removed in SVN r21579, "Cruft Reduction"< but it's not cruft.

Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c	2012-09-10 19:22:22 UTC (rev 22381)
+++ gnucash/trunk/src/engine/Transaction.c	2012-09-11 03:29:39 UTC (rev 22382)
@@ -452,7 +452,43 @@
     return trans;
 }
 
+#ifdef DUMP_FUNCTIONS
+/* Please don't delete this function.  Although it is not called by
+   any other code in GnuCash, it is useful when debugging.  For example
+   it can be called using the gdb "call" command when stopped at a
+   breakpoint.  */
+void
+xaccTransDump (const Transaction *trans, const char *tag)
+{
+    GList *node;
 
+    printf("%s Trans %p", tag, trans);
+    printf("    Entered:     %s\n", gnc_print_date(trans->date_entered));
+    printf("    Posted:      %s\n", gnc_print_date(trans->date_posted));
+    printf("    Num:         %s\n", trans->num ? trans->num : "(null)");
+    printf("    Description: %s\n",
+           trans->description ? trans->description : "(null)");
+    printf("    Currency:    %s\n",
+           gnc_commodity_get_printname(trans->common_currency));
+    printf("    version:     %x\n", qof_instance_get_version(trans));
+    printf("    version_chk: %x\n", qof_instance_get_version_check(trans));
+    printf("    editlevel:   %x\n", qof_instance_get_editlevel(trans));
+    printf("    orig:        %p\n", trans->orig);
+    printf("    idata:       %x\n", qof_instance_get_idata(trans));
+    printf("    splits:      ");
+    for (node = trans->splits; node; node = node->next)
+    {
+        printf("%p ", node->data);
+    }
+    printf("\n");
+    for (node = trans->splits; node; node = node->next)
+    {
+        xaccSplitDump(node->data, tag);
+    }
+    printf("\n");
+}
+#endif
+
 void
 xaccTransSortSplits (Transaction *trans)
 {

Modified: gnucash/trunk/src/engine/Transaction.h
===================================================================
--- gnucash/trunk/src/engine/Transaction.h	2012-09-10 19:22:22 UTC (rev 22381)
+++ gnucash/trunk/src/engine/Transaction.h	2012-09-11 03:29:39 UTC (rev 22382)
@@ -632,6 +632,10 @@
 #define TRANS_SPLITLIST		"split-list" /* for guid_match_all */
 /**@}*/
 
+#ifdef DUMP_FUNCTIONS
+void xaccTransDump (const Transaction *trans, const char *tag);
+#endif
+
 #define RECONCILED_MATCH_TYPE	"reconciled-match"
 
 /** \deprecated */



More information about the gnucash-changes mailing list