From 94e76ae87e883291d13320738fe165c7a2a2415b Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 30 Jul 2004 21:57:02 -0400 Subject: two major changes Complete changed the way format strings are handled. They are now compiled first, which is far more efficient than what was being done before. Also, there is now a global ledger::commodity_t::commodities map, which saves me from having to pass the current journal around to a zillion different functions, for the sole purpose of making sure that all commodity symbols that are parsed refer to the same commodity object. --- binary.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'binary.cc') diff --git a/binary.cc b/binary.cc index f760b83c..9400fc54 100644 --- a/binary.cc +++ b/binary.cc @@ -343,8 +343,8 @@ unsigned int read_binary_ledger(std::istream& in, for (int i = count; --i >= 0; ) { commodity_t * commodity = read_binary_commodity(in); std::pair result - = ledger->commodities.insert(commodities_pair(commodity->symbol, - commodity)); + = commodity_t::commodities.insert(commodities_pair(commodity->symbol, + commodity)); assert(result.second || master); } @@ -593,11 +593,11 @@ void write_binary_ledger(std::ostream& out, ledger_t * ledger, write_binary_account(out, ledger->master); - unsigned long count = ledger->commodities.size(); + unsigned long count = commodity_t::commodities.size(); out.write((char *)&count, sizeof(count)); - for (commodities_map::const_iterator i = ledger->commodities.begin(); - i != ledger->commodities.end(); + for (commodities_map::const_iterator i = commodity_t::commodities.begin(); + i != commodity_t::commodities.end(); i++) write_binary_commodity(out, (*i).second); -- cgit v1.2.3