summaryrefslogtreecommitdiff
path: root/ledger.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-23 07:23:33 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-23 07:23:33 -0400
commitb85a536be720c5beeff07bd9314a1fa8c1870dab (patch)
tree679a8309e6d1fc8e2bdda9d5170d3195a9f1ad38 /ledger.h
parent1091f0d07b8fae388202a449239e8de321545a2a (diff)
downloadfork-ledger-b85a536be720c5beeff07bd9314a1fa8c1870dab.tar.gz
fork-ledger-b85a536be720c5beeff07bd9314a1fa8c1870dab.tar.bz2
fork-ledger-b85a536be720c5beeff07bd9314a1fa8c1870dab.zip
change to binary loading that increases speed by another 20%
Diffstat (limited to 'ledger.h')
-rw-r--r--ledger.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ledger.h b/ledger.h
index 18ae3492..643ee612 100644
--- a/ledger.h
+++ b/ledger.h
@@ -54,11 +54,13 @@ class transaction_t
cost(NULL), flags(_flags), note(_note), data(NULL) {
}
+#ifdef DO_CLEANUP
~transaction_t() {
//assert(! data);
if (cost)
delete cost;
}
+#endif
};
@@ -78,12 +80,14 @@ class entry_t
transactions_list transactions;
entry_t() : date(-1), state(UNCLEARED) {}
+#ifdef DO_CLEANUP
~entry_t() {
for (transactions_list::iterator i = transactions.begin();
i != transactions.end();
i++)
delete *i;
}
+#endif
void add_transaction(transaction_t * xact) {
xact->entry = this;
@@ -120,7 +124,9 @@ class account_t
: parent(_parent), name(_name), note(_note),
depth(parent ? parent->depth + 1 : 0), data(NULL), ident(0) {}
+#ifdef DO_CLEANUP
~account_t();
+#endif
std::string fullname() const;
@@ -163,13 +169,22 @@ class journal_t
account_t * master;
entries_list entries;
strings_list sources;
+#ifdef DO_CLEANUP
+ char * item_pool;
+ char * item_pool_end;
+#endif
mutable accounts_map accounts_cache;
journal_t() {
master = new account_t(NULL, "");
+#ifdef DO_CLEANUP
+ item_pool = NULL;
+#endif
}
+#ifdef DO_CLEANUP
~journal_t();
+#endif
void add_account(account_t * acct) {
master->add_account(acct);