diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-22 02:13:41 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-22 02:13:41 -0400 |
commit | 5619a1d5be144877df8cce01c40ff668bbb0c96a (patch) | |
tree | 387fe6c47cb0998e31e4dfdedc664077d4562407 /format.cc | |
parent | 6d5333b89618734e59853ba7da75b920ac40dae0 (diff) | |
download | fork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.tar.gz fork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.tar.bz2 fork-ledger-5619a1d5be144877df8cce01c40ff668bbb0c96a.zip |
a little more reorganizing, but only fractionally faster. diminishing returns!
Diffstat (limited to 'format.cc')
-rw-r--r-- | format.cc | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -21,7 +21,7 @@ std::string partial_account_name(const account_t * account) for (const account_t * acct = account; acct && acct->parent; acct = acct->parent) { - if (acct->dflags & ACCOUNT_DISPLAYED) + if (acct->data && ACCT_DATA(acct)->dflags & ACCOUNT_DISPLAYED) break; if (name.empty()) @@ -35,12 +35,12 @@ std::string partial_account_name(const account_t * account) std::string format_t::date_format = "%Y/%m/%d"; -#ifdef NO_CLEANUP -value_expr_t * format_t::value_expr = NULL; -value_expr_t * format_t::total_expr = NULL; -#else +#ifdef DO_CLEANUP std::auto_ptr<value_expr_t> format_t::value_expr; std::auto_ptr<value_expr_t> format_t::total_expr; +#else +value_expr_t * format_t::value_expr = NULL; +value_expr_t * format_t::total_expr = NULL; #endif element_t * format_t::parse_elements(const std::string& fmt) @@ -186,12 +186,12 @@ void format_t::format_elements(std::ostream& out, case element_t::VALUE_EXPR: { value_expr_t * expr = NULL; switch (elem->type) { -#ifdef NO_CLEANUP - case element_t::VALUE: expr = value_expr; break; - case element_t::TOTAL: expr = total_expr; break; -#else +#ifdef DO_CLEANUP case element_t::VALUE: expr = value_expr.get(); break; case element_t::TOTAL: expr = total_expr.get(); break; +#else + case element_t::VALUE: expr = value_expr; break; + case element_t::TOTAL: expr = total_expr; break; #endif case element_t::VALUE_EXPR: expr = elem->val_expr; break; @@ -336,7 +336,7 @@ void format_t::format_elements(std::ostream& out, for (const account_t * acct = details.account; acct; acct = acct->parent) - if (acct->dflags & ACCOUNT_DISPLAYED) { + if (acct->data && ACCT_DATA(acct)->dflags & ACCOUNT_DISPLAYED) { if (elem->min_width > 0 || elem->max_width > 0) out.width(elem->min_width > elem->max_width ? elem->min_width : elem->max_width); @@ -393,7 +393,7 @@ bool format_account::display_account(const account_t * account, const item_predicate<account_t>& disp_pred) { // Never display an account that has already been displayed. - if (account->dflags & ACCOUNT_DISPLAYED) + if (account->data && ACCT_DATA(account)->dflags & ACCOUNT_DISPLAYED) return false; // At this point, one of two possibilities exists: the account is a |