diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-02 19:17:43 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-02 19:17:43 -0500 |
commit | 46e46dd5a337c009391583a679d6172cf4f5aa42 (patch) | |
tree | 67009e7d8681685afec8b09dcb7930570492e36f /src/account.cc | |
parent | a048afc8a34d3a1c1a6372ef6b7cc373779bcac0 (diff) | |
parent | d6790072eff9cb2a938ee9ed204263ee277a6874 (diff) | |
download | fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.tar.gz fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.tar.bz2 fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.zip |
Merge branch 'next'
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/account.cc b/src/account.cc index 52a6b436..23761049 100644 --- a/src/account.cc +++ b/src/account.cc @@ -42,10 +42,9 @@ account_t::~account_t() { TRACE_DTOR(account_t); - foreach (accounts_map::value_type& pair, accounts) { - assert(! pair.second->has_flags(ACCOUNT_TEMP)); - checked_delete(pair.second); - } + foreach (accounts_map::value_type& pair, accounts) + if (! pair.second->has_flags(ACCOUNT_TEMP)) + checked_delete(pair.second); } account_t * account_t::find_account(const string& name, @@ -55,7 +54,7 @@ account_t * account_t::find_account(const string& name, if (i != accounts.end()) return (*i).second; - char buf[256]; + char buf[8192]; string::size_type sep = name.find(':'); assert(sep < 256|| sep == string::npos); @@ -398,6 +397,21 @@ value_t account_t::amount(const optional<expr_t&>& expr) const xdata_->self_details.last_post = i; } + if (xdata_->self_details.last_reported_post) + i = *xdata_->self_details.last_reported_post; + else + i = xdata_->reported_posts.begin(); + + for (; i != xdata_->reported_posts.end(); i++) { + if ((*i)->xdata().has_flags(POST_EXT_VISITED)) { + if (! (*i)->xdata().has_flags(POST_EXT_CONSIDERED)) { + (*i)->add_to_value(xdata_->self_details.total, expr); + (*i)->xdata().add_flags(POST_EXT_CONSIDERED); + } + } + xdata_->self_details.last_reported_post = i; + } + return xdata_->self_details.total; } else { return NULL_VALUE; |