From 8276b51f5692796bfdf75dd64f709e0de1c7caaf Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 31 Jul 2008 04:28:58 -0400 Subject: A new binary_cache_t object has been creating to manage saving and restoring a Ledger session from a cache file. It doesn't work at all yet, though at least the major structures are in place now. --- journal.cc | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'journal.cc') diff --git a/journal.cc b/journal.cc index 9b8d47b4..5ad9dc08 100644 --- a/journal.cc +++ b/journal.cc @@ -36,11 +36,11 @@ namespace ledger { const string version = PACKAGE_VERSION; -journal_t::journal_t(session_t * _owner) : - owner(_owner), basket(NULL), item_pool(NULL), item_pool_end(NULL) +journal_t::journal_t(session_t * _owner) + : owner(_owner), basket(NULL) { TRACE_CTOR(journal_t, ""); - master = owner->master; + master = owner->master.get(); } journal_t::~journal_t() @@ -52,22 +52,16 @@ journal_t::~journal_t() // be deleted. for (entries_list::iterator i = entries.begin(); i != entries.end(); - i++) { - if (! item_pool || - reinterpret_cast(*i) < item_pool || - reinterpret_cast(*i) >= item_pool_end) { + i++) + if (! (*i)->has_flags(ENTRY_IN_CACHE)) checked_delete(*i); - } else { + else (*i)->~entry_t(); - } - } for (auto_entries_list::iterator i = auto_entries.begin(); i != auto_entries.end(); i++) - if (! item_pool || - reinterpret_cast(*i) < item_pool || - reinterpret_cast(*i) >= item_pool_end) + if (! (*i)->has_flags(ENTRY_IN_CACHE)) checked_delete(*i); else (*i)->~auto_entry_t(); @@ -75,15 +69,10 @@ journal_t::~journal_t() for (period_entries_list::iterator i = period_entries.begin(); i != period_entries.end(); i++) - if (! item_pool || - reinterpret_cast(*i) < item_pool || - reinterpret_cast(*i) >= item_pool_end) + if (! (*i)->has_flags(ENTRY_IN_CACHE)) checked_delete(*i); else (*i)->~period_entry_t(); - - if (item_pool) - checked_array_delete(item_pool); } void journal_t::add_account(account_t * acct) -- cgit v1.2.3