From 7901598f1d1e419e19c860e81749805371298030 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 27 Feb 2006 23:52:31 +0000 Subject: Checked in all major updates. --- walk.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'walk.h') diff --git a/walk.h b/walk.h index 887963bf..0f8c6956 100644 --- a/walk.h +++ b/walk.h @@ -120,6 +120,11 @@ inline const account_t * xact_account(const transaction_t& xact) { return xact_account(const_cast(xact)); } +extern bool show_lots; + +#define translate_amount(amt) \ + ((! show_lots && amt.commodity().price) ? amt.base_amount() : amt) + ////////////////////////////////////////////////////////////////////// inline void walk_transactions(transactions_list::iterator begin, @@ -212,20 +217,19 @@ class sort_transactions : public item_handler transactions_deque transactions; const value_expr_t * sort_order; - bool allocated; public: sort_transactions(item_handler * handler, const value_expr_t * _sort_order) : item_handler(handler), - sort_order(_sort_order), allocated(false) {} + sort_order(_sort_order) {} sort_transactions(item_handler * handler, const std::string& _sort_order) - : item_handler(handler), allocated(false) { + : item_handler(handler) { try { sort_order = parse_value_expr(_sort_order); - allocated = true; + sort_order->acquire(); } catch (value_expr_error& err) { throw value_expr_error(std::string("In sort string '") + _sort_order + @@ -235,8 +239,7 @@ class sort_transactions : public item_handler virtual ~sort_transactions() { assert(sort_order); - if (allocated) - delete sort_order; + sort_order->release(); } virtual void post_accumulated_xacts(); -- cgit v1.2.3