diff options
author | John Wiegley <johnw@newartisans.com> | 2003-10-01 07:11:57 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2003-10-01 07:11:57 +0000 |
commit | a40813d896fd929e92969c06229844073d58565d (patch) | |
tree | 055605364d055b20604c8d1423bede9628c2fcce /ledger.cc | |
parent | 68e6b8538e9c6fd39cb5d6ff80c65f3181763413 (diff) | |
download | fork-ledger-a40813d896fd929e92969c06229844073d58565d.tar.gz fork-ledger-a40813d896fd929e92969c06229844073d58565d.tar.bz2 fork-ledger-a40813d896fd929e92969c06229844073d58565d.zip |
*** empty log message ***
Diffstat (limited to 'ledger.cc')
-rw-r--r-- | ledger.cc | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -96,12 +96,16 @@ bool entry::matches(const std::list<mask>& regexps) const } } +#ifdef DO_CLEANUP + totals::~totals() { for (iterator i = amounts.begin(); i != amounts.end(); i++) delete (*i).second; } +#endif // DO_CLEANUP + void totals::credit(const totals& other) { for (const_iterator i = other.amounts.begin(); @@ -236,9 +240,10 @@ bool matches(const std::list<mask>& regexps, const std::string& str, return match; } +#ifdef DO_CLEANUP + state::~state() { -#if 0 for (commodities_iterator i = commodities.begin(); i != commodities.end(); i++) @@ -253,9 +258,10 @@ state::~state() i != entries.end(); i++) delete *i; -#endif } +#endif // DO_CLEANUP + void state::record_price(const char * setting) { char buf[128]; @@ -275,6 +281,10 @@ void state::record_price(const char * setting) account * state::find_account(const char * name, bool create) { + accounts_iterator i = accounts_cache.find(name); + if (i != accounts_cache.end()) + return (*i).second; + char * buf = new char[std::strlen(name) + 1]; std::strcpy(buf, name); @@ -307,6 +317,9 @@ account * state::find_account(const char * name, bool create) delete[] buf; + if (current) + accounts_cache.insert(accounts_entry(name, current)); + return current; } |