summaryrefslogtreecommitdiff
path: root/src/session.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-07 10:24:55 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:38 -0400
commit8aada79971b772fda92131053fa03021cfbc625a (patch)
treefbb25be31a419958167d1d166ab0f35d3b7f6a86 /src/session.cc
parent65e4fc7ebff0245fe13f99663c341e000a29af48 (diff)
downloadledger-8aada79971b772fda92131053fa03021cfbc625a.tar.gz
ledger-8aada79971b772fda92131053fa03021cfbc625a.tar.bz2
ledger-8aada79971b772fda92131053fa03021cfbc625a.zip
Added a facility for handling scoped executions.
Diffstat (limited to 'src/session.cc')
-rw-r--r--src/session.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/session.cc b/src/session.cc
index d53faf09..1477139c 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -103,22 +103,13 @@ journal_t * session_t::read_data(const string& master_account)
DEBUG("ledger.cache", "using_cache " << cache_file->string());
cache_dirty = true;
if (exists(*cache_file)) {
- ifstream stream(*cache_file);
-
- optional<path> price_db_orig = journal->price_db;
- try {
- journal->price_db = price_db;
-
- entry_count += read_journal(stream, journal, NULL, data_file);
- if (entry_count > 0)
- cache_dirty = false;
+ scoped_variable<optional<path> >
+ save_price_db(journal->price_db, price_db);
- journal->price_db = price_db_orig;
- }
- catch (...) {
- journal->price_db = price_db_orig;
- throw;
- }
+ ifstream stream(*cache_file);
+ entry_count += read_journal(stream, journal, NULL, data_file);
+ if (entry_count > 0)
+ cache_dirty = false;
}
}