Don't use archive_t if boost_serialization unavailable

This commit is contained in:
John Wiegley 2009-11-06 16:17:30 -05:00
parent f03d386013
commit 3f00f8362c

View file

@ -99,6 +99,7 @@ std::size_t session_t::read_data(const string& master_account)
if (HANDLED(price_db_)) if (HANDLED(price_db_))
price_db_path = resolve_path(HANDLER(price_db_).str()); price_db_path = resolve_path(HANDLER(price_db_).str());
#if defined(HAVE_BOOST_SERIALIZATION)
optional<archive_t> cache; optional<archive_t> cache;
if (HANDLED(cache_) && master_account.empty()) if (HANDLED(cache_) && master_account.empty())
cache = archive_t(HANDLED(cache_).str()); cache = archive_t(HANDLED(cache_).str());
@ -106,6 +107,7 @@ std::size_t session_t::read_data(const string& master_account)
if (! (cache && if (! (cache &&
cache->should_load(HANDLER(file_).data_files) && cache->should_load(HANDLER(file_).data_files) &&
cache->load(journal))) { cache->load(journal))) {
#endif // HAVE_BOOST_SERIALIZATION
if (price_db_path) { if (price_db_path) {
if (exists(*price_db_path)) { if (exists(*price_db_path)) {
if (journal->read(*price_db_path) > 0) if (journal->read(*price_db_path) > 0)
@ -139,9 +141,11 @@ std::size_t session_t::read_data(const string& master_account)
assert(xact_count == journal->xacts.size()); assert(xact_count == journal->xacts.size());
#if defined(HAVE_BOOST_SERIALIZATION)
if (cache && cache->should_save(journal)) if (cache && cache->should_save(journal))
cache->save(journal); cache->save(journal);
} }
#endif // HAVE_BOOST_SERIALIZATION
if (populated_data_files) if (populated_data_files)
HANDLER(file_).data_files.clear(); HANDLER(file_).data_files.clear();