summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-20 02:10:40 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-20 02:10:40 -0500
commit22505d9527edce59cd3cf90c5241e4bd809eb8a2 (patch)
treed943b2dba416a9fbe8619e02a293dfd854fd0869 /src
parentdf11ecbbd733068284a19369949bcaa20b0e6e76 (diff)
downloadfork-ledger-22505d9527edce59cd3cf90c5241e4bd809eb8a2.tar.gz
fork-ledger-22505d9527edce59cd3cf90c5241e4bd809eb8a2.tar.bz2
fork-ledger-22505d9527edce59cd3cf90c5241e4bd809eb8a2.zip
Always call TRACE_CTOR at the end of constructors
Diffstat (limited to 'src')
-rw-r--r--src/amount.cc10
-rw-r--r--src/amount.h8
-rw-r--r--src/annotate.h2
-rw-r--r--src/balance.cc6
-rw-r--r--src/balance.h6
-rw-r--r--src/csv.h2
-rw-r--r--src/draft.h2
-rw-r--r--src/expr.cc4
-rw-r--r--src/filters.cc12
-rw-r--r--src/filters.h15
-rw-r--r--src/format.h2
-rw-r--r--src/generate.cc3
-rw-r--r--src/global.cc4
-rw-r--r--src/item.h4
-rw-r--r--src/iterators.h14
-rw-r--r--src/journal.cc6
-rw-r--r--src/journal.h2
-rw-r--r--src/mask.cc2
-rw-r--r--src/option.h2
-rw-r--r--src/org.cc4
-rw-r--r--src/output.cc8
-rw-r--r--src/pool.cc2
-rw-r--r--src/post.h2
-rw-r--r--src/pstream.h8
-rw-r--r--src/pyfstream.h8
-rw-r--r--src/query.h8
-rw-r--r--src/scope.h2
-rw-r--r--src/session.cc4
-rw-r--r--src/times.h5
-rw-r--r--src/unistring.h4
-rw-r--r--src/utils.cc12
-rw-r--r--src/value.h34
32 files changed, 106 insertions, 101 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 5fa58528..8c5ae574 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -63,16 +63,16 @@ struct amount_t::bigint_t : public supports_flags<>
#define MP(bigint) ((bigint)->val)
bigint_t() : prec(0), refc(1) {
- TRACE_CTOR(bigint_t, "");
mpq_init(val);
+ TRACE_CTOR(bigint_t, "");
}
bigint_t(const bigint_t& other)
: supports_flags<>(static_cast<uint_least8_t>
(other.flags() & ~BIGINT_BULK_ALLOC)),
prec(other.prec), refc(1) {
- TRACE_CTOR(bigint_t, "copy");
mpq_init(val);
mpq_set(val, other.val);
+ TRACE_CTOR(bigint_t, "copy");
}
~bigint_t() {
TRACE_DTOR(bigint_t);
@@ -349,24 +349,24 @@ void amount_t::_release()
amount_t::amount_t(const double val) : commodity_(NULL)
{
- TRACE_CTOR(amount_t, "const double");
quantity = new bigint_t;
mpq_set_d(MP(quantity), val);
quantity->prec = extend_by_digits; // an approximation
+ TRACE_CTOR(amount_t, "const double");
}
amount_t::amount_t(const unsigned long val) : commodity_(NULL)
{
- TRACE_CTOR(amount_t, "const unsigned long");
quantity = new bigint_t;
mpq_set_ui(MP(quantity), val, 1);
+ TRACE_CTOR(amount_t, "const unsigned long");
}
amount_t::amount_t(const long val) : commodity_(NULL)
{
- TRACE_CTOR(amount_t, "const long");
quantity = new bigint_t;
mpq_set_si(MP(quantity), val, 1);
+ TRACE_CTOR(amount_t, "const long");
}
diff --git a/src/amount.h b/src/amount.h
index 903a01cd..10e83552 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -155,17 +155,17 @@ public:
commodity_t::null_commodity. The number may be of infinite
precision. */
explicit amount_t(const string& val) : quantity(NULL) {
- TRACE_CTOR(amount_t, "const string&");
parse(val);
+ TRACE_CTOR(amount_t, "const string&");
}
/** Parse a pointer to a C string as an (optionally commoditized)
amount. If no commodity is present, the resulting commodity is \c
commodity_t::null_commodity. The number may be of infinite
precision. */
explicit amount_t(const char * val) : quantity(NULL) {
- TRACE_CTOR(amount_t, "const char *");
assert(val);
parse(val);
+ TRACE_CTOR(amount_t, "const char *");
}
/*@}*/
@@ -195,21 +195,21 @@ public:
same memory used by the original via reference counting. The \c
amount_t::bigint_t class in amount.cc maintains the reference. */
amount_t(const amount_t& amt) : quantity(NULL) {
- TRACE_CTOR(amount_t, "copy");
if (amt.quantity)
_copy(amt);
else
commodity_ = NULL;
+ TRACE_CTOR(amount_t, "copy");
}
/** Copy an amount object, applying the given commodity annotation
details afterward. This is equivalent to doing a normal copy
(@see amount_t(const amount_t&)) and then calling
amount_t::annotate(). */
amount_t(const amount_t& amt, const annotation_t& details) : quantity(NULL) {
- TRACE_CTOR(amount_t, "const amount_t&, const annotation_t&");
assert(amt.quantity);
_copy(amt);
annotate(details);
+ TRACE_CTOR(amount_t, "const amount_t&, const annotation_t&");
}
/** Assign an amount object. This is like copying if the amount was
null beforehand, otherwise the previous value's reference is must
diff --git a/src/annotate.h b/src/annotate.h
index 163ffac5..85a34662 100644
--- a/src/annotate.h
+++ b/src/annotate.h
@@ -226,9 +226,9 @@ protected:
explicit annotated_commodity_t(commodity_t * _ptr,
const annotation_t& _details)
: commodity_t(_ptr->parent_, _ptr->base), ptr(_ptr), details(_details) {
- TRACE_CTOR(annotated_commodity_t, "commodity_t *, annotation_t");
annotated = true;
qualified_symbol = _ptr->qualified_symbol;
+ TRACE_CTOR(annotated_commodity_t, "commodity_t *, annotation_t");
}
public:
diff --git a/src/balance.cc b/src/balance.cc
index f87e8bbd..5c57cd99 100644
--- a/src/balance.cc
+++ b/src/balance.cc
@@ -41,23 +41,23 @@ namespace ledger {
balance_t::balance_t(const double val)
{
- TRACE_CTOR(balance_t, "const double");
amounts.insert
(amounts_map::value_type(commodity_pool_t::current_pool->null_commodity, val));
+ TRACE_CTOR(balance_t, "const double");
}
balance_t::balance_t(const unsigned long val)
{
- TRACE_CTOR(balance_t, "const unsigned long");
amounts.insert
(amounts_map::value_type(commodity_pool_t::current_pool->null_commodity, val));
+ TRACE_CTOR(balance_t, "const unsigned long");
}
balance_t::balance_t(const long val)
{
- TRACE_CTOR(balance_t, "const long");
amounts.insert
(amounts_map::value_type(commodity_pool_t::current_pool->null_commodity, val));
+ TRACE_CTOR(balance_t, "const long");
}
balance_t& balance_t::operator+=(const balance_t& bal)
diff --git a/src/balance.h b/src/balance.h
index 5f0d52ed..11c370bb 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -108,26 +108,26 @@ public:
TRACE_CTOR(balance_t, "");
}
balance_t(const amount_t& amt) {
- TRACE_CTOR(balance_t, "const amount_t&");
if (amt.is_null())
throw_(balance_error,
_("Cannot initialize a balance from an uninitialized amount"));
if (! amt.is_realzero())
amounts.insert(amounts_map::value_type(&amt.commodity(), amt));
+ TRACE_CTOR(balance_t, "const amount_t&");
}
balance_t(const double val);
balance_t(const unsigned long val);
balance_t(const long val);
explicit balance_t(const string& val) {
- TRACE_CTOR(balance_t, "const string&");
amount_t temp(val);
amounts.insert(amounts_map::value_type(&temp.commodity(), temp));
+ TRACE_CTOR(balance_t, "const string&");
}
explicit balance_t(const char * val) {
- TRACE_CTOR(balance_t, "const char *");
amount_t temp(val);
amounts.insert(amounts_map::value_type(&temp.commodity(), temp));
+ TRACE_CTOR(balance_t, "const char *");
}
/**
diff --git a/src/csv.h b/src/csv.h
index d98c0567..7d5098d2 100644
--- a/src/csv.h
+++ b/src/csv.h
@@ -91,8 +91,8 @@ public:
cost_mask("cost"),
total_mask("total"),
note_mask("note") {
- TRACE_CTOR(csv_reader, "parse_context_t&");
read_index(*context.stream.get());
+ TRACE_CTOR(csv_reader, "parse_context_t&");
}
~csv_reader() {
TRACE_DTOR(csv_reader);
diff --git a/src/draft.h b/src/draft.h
index e5d29134..46aa26e1 100644
--- a/src/draft.h
+++ b/src/draft.h
@@ -92,9 +92,9 @@ class draft_t : public expr_base_t<value_t>
public:
draft_t(const value_t& args) : base_type() {
- TRACE_CTOR(draft_t, "value_t");
if (! args.empty())
parse_args(args);
+ TRACE_CTOR(draft_t, "value_t");
}
virtual ~draft_t() throw() {
TRACE_DTOR(draft_t);
diff --git a/src/expr.cc b/src/expr.cc
index b22572f8..25967207 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -55,16 +55,16 @@ expr_t::expr_t(ptr_op_t _ptr, scope_t * _context)
expr_t::expr_t(const string& _str, const parse_flags_t& flags)
: base_type()
{
- TRACE_CTOR(expr_t, "string, parse_flags_t");
if (! _str.empty())
parse(_str, flags);
+ TRACE_CTOR(expr_t, "string, parse_flags_t");
}
expr_t::expr_t(std::istream& in, const parse_flags_t& flags)
: base_type()
{
- TRACE_CTOR(expr_t, "std::istream&, parse_flags_t");
parse(in, flags);
+ TRACE_CTOR(expr_t, "std::istream&, parse_flags_t");
}
expr_t::~expr_t() {
diff --git a/src/filters.cc b/src/filters.cc
index 73ee200d..5915ad3c 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -512,8 +512,8 @@ display_filter_posts::display_filter_posts(post_handler_ptr handler,
display_total_expr(report.HANDLER(display_total_).expr),
show_rounding(_show_rounding)
{
- TRACE_CTOR(display_filter_posts, "post_handler_ptr, report_t&, bool");
create_accounts();
+ TRACE_CTOR(display_filter_posts, "post_handler_ptr, report_t&, bool");
}
bool display_filter_posts::output_rounding(post_t& post)
@@ -598,9 +598,6 @@ changed_value_posts::changed_value_posts
show_unrealized(_show_unrealized), last_post(NULL),
display_filter(_display_filter)
{
- TRACE_CTOR(changed_value_posts,
- "post_handler_ptr, report_t&, bool, bool, display_filter_posts *");
-
string gains_equity_account_name;
if (report.HANDLED(unrealized_gains_))
gains_equity_account_name = report.HANDLER(unrealized_gains_).str();
@@ -620,6 +617,9 @@ changed_value_posts::changed_value_posts
losses_equity_account->add_flags(ACCOUNT_GENERATED);
create_accounts();
+
+ TRACE_CTOR(changed_value_posts,
+ "post_handler_ptr, report_t&, bool, bool, display_filter_posts *");
}
void changed_value_posts::flush()
@@ -1417,8 +1417,6 @@ inject_posts::inject_posts(post_handler_ptr handler,
account_t * master)
: item_handler<post_t>(handler)
{
- TRACE_CTOR(inject_posts, "post_handler_ptr, string, account_t *");
-
scoped_array<char> buf(new char[tag_list.length() + 1]);
std::strcpy(buf.get(), tag_list.c_str());
@@ -1435,6 +1433,8 @@ inject_posts::inject_posts(post_handler_ptr handler,
tags_list.push_back
(tags_list_pair(q, tag_mapping_pair(account, tag_injected_set())));
}
+
+ TRACE_CTOR(inject_posts, "post_handler_ptr, string, account_t *");
}
void inject_posts::operator()(post_t& post)
diff --git a/src/filters.h b/src/filters.h
index 3e766863..ab226429 100644
--- a/src/filters.h
+++ b/src/filters.h
@@ -75,8 +75,8 @@ public:
expr_t& _group_by_expr)
: post_chain(_post_chain), report(_report),
group_by_expr(_group_by_expr) {
+ preflush_func = bind(&post_splitter::print_title, this, _1);
TRACE_CTOR(post_splitter, "scope_t&, post_handler_ptr, expr_t");
- preflush_func = bind(&post_splitter::print_title, this, _1);
}
virtual ~post_splitter() {
TRACE_DTOR(post_splitter);
@@ -154,8 +154,6 @@ class pass_down_posts : public item_handler<post_t>
public:
pass_down_posts(post_handler_ptr handler, Iterator& iter)
: item_handler<post_t>(handler) {
- TRACE_CTOR(pass_down_posts, "post_handler_ptr, posts_iterator");
-
while (post_t * post = *iter) {
try {
item_handler<post_t>::operator()(*post);
@@ -168,6 +166,8 @@ public:
}
item_handler<post_t>::flush();
+
+ TRACE_CTOR(pass_down_posts, "post_handler_ptr, posts_iterator");
}
virtual ~pass_down_posts() {
@@ -448,8 +448,8 @@ public:
only_predicate(_only_predicate), count(0),
last_xact(NULL), last_post(NULL),
only_collapse_if_zero(_only_collapse_if_zero), report(_report) {
- TRACE_CTOR(collapse_posts, "post_handler_ptr, ...");
create_accounts();
+ TRACE_CTOR(collapse_posts, "post_handler_ptr, ...");
}
virtual ~collapse_posts() {
TRACE_DTOR(collapse_posts);
@@ -499,8 +499,7 @@ public:
const bool _also_matching = false)
: item_handler<post_t>(handler),
also_matching(_also_matching) {
- TRACE_CTOR(related_posts,
- "post_handler_ptr, const bool");
+ TRACE_CTOR(related_posts, "post_handler_ptr, const bool");
}
virtual ~related_posts() throw() {
TRACE_DTOR(related_posts);
@@ -722,9 +721,9 @@ public:
: subtotal_posts(_handler, amount_expr), start_interval(_interval),
interval(start_interval), exact_periods(_exact_periods),
generate_empty_posts(_generate_empty_posts) {
+ create_accounts();
TRACE_CTOR(interval_posts,
"post_handler_ptr, expr_t&, date_interval_t, bool, bool");
- create_accounts();
}
virtual ~interval_posts() throw() {
TRACE_DTOR(interval_posts);
@@ -774,8 +773,8 @@ public:
posts_as_equity(post_handler_ptr _handler, report_t& _report,
expr_t& amount_expr)
: subtotal_posts(_handler, amount_expr), report(_report) {
- TRACE_CTOR(posts_as_equity, "post_handler_ptr, expr_t&");
create_accounts();
+ TRACE_CTOR(posts_as_equity, "post_handler_ptr, expr_t&");
}
virtual ~posts_as_equity() throw() {
TRACE_DTOR(posts_as_equity);
diff --git a/src/format.h b/src/format.h
index 60ae2abe..cc48bdda 100644
--- a/src/format.h
+++ b/src/format.h
@@ -125,9 +125,9 @@ public:
}
format_t(const string& _str, scope_t * context = NULL)
: base_type(context) {
- TRACE_CTOR(format_t, "const string&");
if (! _str.empty())
parse_format(_str);
+ TRACE_CTOR(format_t, "const string&");
}
virtual ~format_t() {
TRACE_DTOR(format_t);
diff --git a/src/generate.cc b/src/generate.cc
index edd58632..8769c99c 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -63,8 +63,6 @@ generate_posts_iterator::generate_posts_iterator
neg_number_range(-10000, -1), neg_number_gen(rnd_gen, neg_number_range),
pos_number_range(1, 10000), pos_number_gen(rnd_gen, pos_number_range)
{
- TRACE_CTOR(generate_posts_iterator, "bool");
-
std::ostringstream next_date_buf;
generate_date(next_date_buf);
next_date = parse_date(next_date_buf.str());
@@ -73,6 +71,7 @@ generate_posts_iterator::generate_posts_iterator
generate_date(next_aux_date_buf);
next_aux_date = parse_date(next_aux_date_buf.str());
+ TRACE_CTOR(generate_posts_iterator, "bool");
}
void generate_posts_iterator::generate_string(std::ostream& out, int len,
diff --git a/src/global.cc b/src/global.cc
index b5ceb614..6dc8d150 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -47,8 +47,6 @@ static bool args_only = false;
global_scope_t::global_scope_t(char ** envp)
{
- TRACE_CTOR(global_scope_t, "");
-
epoch = CURRENT_TIME();
#if defined(HAVE_BOOST_PYTHON)
@@ -89,6 +87,8 @@ global_scope_t::global_scope_t(char ** envp)
} else {
session().HANDLER(price_db_).off();
}
+
+ TRACE_CTOR(global_scope_t, "");
}
global_scope_t::~global_scope_t()
diff --git a/src/item.h b/src/item.h
index e7415918..a1160329 100644
--- a/src/item.h
+++ b/src/item.h
@@ -60,8 +60,8 @@ struct position_t
TRACE_CTOR(position_t, "");
}
position_t(const position_t& pos) {
- TRACE_CTOR(position_t, "copy");
*this = pos;
+ TRACE_CTOR(position_t, "copy");
}
~position_t() throw() {
TRACE_DTOR(position_t);
@@ -125,8 +125,8 @@ public:
}
item_t(const item_t& item) : supports_flags<uint_least16_t>(), scope_t()
{
- TRACE_CTOR(item_t, "copy");
copy_details(item);
+ TRACE_CTOR(item_t, "copy");
}
virtual ~item_t() {
TRACE_DTOR(item_t);
diff --git a/src/iterators.h b/src/iterators.h
index 922ebccd..53814666 100644
--- a/src/iterators.h
+++ b/src/iterators.h
@@ -100,8 +100,8 @@ public:
}
xact_posts_iterator(xact_t& xact)
: posts_uninitialized(true) {
- TRACE_CTOR(xact_posts_iterator, "xact_t&");
reset(xact);
+ TRACE_CTOR(xact_posts_iterator, "xact_t&");
}
xact_posts_iterator(const xact_posts_iterator& i)
: iterator_facade_base<xact_posts_iterator, post_t *,
@@ -145,13 +145,13 @@ public:
TRACE_CTOR(xacts_iterator, "");
}
xacts_iterator(journal_t& journal) : xacts_uninitialized(false) {
- TRACE_CTOR(xacts_iterator, "journal_t&");
reset(journal);
+ TRACE_CTOR(xacts_iterator, "journal_t&");
}
xacts_iterator(xacts_list::iterator beg,
xacts_list::iterator end) : xacts_uninitialized(false) {
- TRACE_CTOR(xacts_iterator, "xacts_list::iterator, xacts_list::iterator");
reset(beg, end);
+ TRACE_CTOR(xacts_iterator, "xacts_list::iterator, xacts_list::iterator");
}
xacts_iterator(const xacts_iterator& i)
: iterator_facade_base<xacts_iterator, xact_t *,
@@ -187,8 +187,8 @@ public:
TRACE_CTOR(journal_posts_iterator, "");
}
journal_posts_iterator(journal_t& journal) {
- TRACE_CTOR(journal_posts_iterator, "journal_t&");
reset(journal);
+ TRACE_CTOR(journal_posts_iterator, "journal_t&");
}
journal_posts_iterator(const journal_posts_iterator& i)
: iterator_facade_base<journal_posts_iterator, post_t *,
@@ -221,8 +221,8 @@ public:
TRACE_CTOR(posts_commodities_iterator, "");
}
posts_commodities_iterator(journal_t& journal) {
- TRACE_CTOR(posts_commodities_iterator, "journal_t&");
reset(journal);
+ TRACE_CTOR(posts_commodities_iterator, "journal_t&");
}
posts_commodities_iterator(const posts_commodities_iterator& i)
: iterator_facade_base<posts_commodities_iterator, post_t *,
@@ -252,9 +252,9 @@ public:
TRACE_CTOR(basic_accounts_iterator, "");
}
basic_accounts_iterator(account_t& account) {
- TRACE_CTOR(basic_accounts_iterator, "account_t&");
push_back(account);
increment();
+ TRACE_CTOR(basic_accounts_iterator, "account_t&");
}
basic_accounts_iterator(const basic_accounts_iterator& i)
: iterator_facade_base<basic_accounts_iterator, account_t *,
@@ -292,9 +292,9 @@ public:
sorted_accounts_iterator(account_t& account,
const expr_t& _sort_cmp, bool _flatten_all)
: sort_cmp(_sort_cmp), flatten_all(_flatten_all) {
- TRACE_CTOR(sorted_accounts_iterator, "account_t&, expr_t, bool");
push_back(account);
increment();
+ TRACE_CTOR(sorted_accounts_iterator, "account_t&, expr_t, bool");
}
sorted_accounts_iterator(const sorted_accounts_iterator& i)
: iterator_facade_base<sorted_accounts_iterator, account_t *,
diff --git a/src/journal.cc b/src/journal.cc
index be6a8e51..49d86ff0 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -44,23 +44,23 @@ namespace ledger {
journal_t::journal_t()
{
- TRACE_CTOR(journal_t, "");
initialize();
+ TRACE_CTOR(journal_t, "");
}
#if 0
journal_t::journal_t(const path& pathname)
{
- TRACE_CTOR(journal_t, "path");
initialize();
read(pathname);
+ TRACE_CTOR(journal_t, "path");
}
journal_t::journal_t(const string& str)
{
- TRACE_CTOR(journal_t, "string");
initialize();
read(str);
+ TRACE_CTOR(journal_t, "string");
}
#endif
diff --git a/src/journal.h b/src/journal.h
index 759826a0..a7a84447 100644
--- a/src/journal.h
+++ b/src/journal.h
@@ -85,9 +85,9 @@ public:
}
fileinfo_t(const path& _filename)
: filename(_filename), from_stream(false) {
- TRACE_CTOR(journal_t::fileinfo_t, "const path&");
size = file_size(*filename);
modtime = posix_time::from_time_t(last_write_time(*filename));
+ TRACE_CTOR(journal_t::fileinfo_t, "const path&");
}
fileinfo_t(const fileinfo_t& info)
: filename(info.filename), size(info.size),
diff --git a/src/mask.cc b/src/mask.cc
index 5bc10d5f..afb68ca0 100644
--- a/src/mask.cc
+++ b/src/mask.cc
@@ -37,8 +37,8 @@ namespace ledger {
mask_t::mask_t(const string& pat) : expr()
{
- TRACE_CTOR(mask_t, "const string&");
*this = pat;
+ TRACE_CTOR(mask_t, "const string&");
}
mask_t& mask_t::operator=(const string& pat)
diff --git a/src/option.h b/src/option.h
index 36dba3a4..772f2b01 100644
--- a/src/option.h
+++ b/src/option.h
@@ -69,8 +69,8 @@ public:
: name(_name), name_len(std::strlen(name)), ch(_ch),
handled(false), parent(NULL), value(),
wants_arg(name[name_len - 1] == '_') {
- TRACE_CTOR(option_t, "const char *, const char");
DEBUG("option.names", "Option: " << name);
+ TRACE_CTOR(option_t, "const char *, const char");
}
option_t(const option_t& other)
: name(other.name),
diff --git a/src/org.cc b/src/org.cc
index 3c897f54..70427321 100644
--- a/src/org.cc
+++ b/src/org.cc
@@ -45,8 +45,6 @@ posts_to_org_table::posts_to_org_table(report_t& _report,
const optional<string>& _prepend_format)
: report(_report), last_xact(NULL), last_post(NULL)
{
- TRACE_CTOR(posts_to_org_table, "report&, optional<string>");
-
first_line_format.parse_format
("|%(format_date(date))"
"|%(code)"
@@ -79,6 +77,8 @@ posts_to_org_table::posts_to_org_table(report_t& _report,
if (_prepend_format)
prepend_format.parse_format(*_prepend_format);
+
+ TRACE_CTOR(posts_to_org_table, "report&, optional<string>");
}
void posts_to_org_table::flush()
diff --git a/src/output.cc b/src/output.cc
index aaf81f60..742000bd 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -47,8 +47,6 @@ format_posts::format_posts(report_t& _report,
: report(_report), prepend_width(_prepend_width),
last_xact(NULL), last_post(NULL), first_report_title(true)
{
- TRACE_CTOR(format_posts, "report&, const string&, bool");
-
const char * f = format.c_str();
if (const char * p = std::strstr(f, "%/")) {
@@ -70,6 +68,8 @@ format_posts::format_posts(report_t& _report,
if (_prepend_format)
prepend_format.parse_format(*_prepend_format);
+
+ TRACE_CTOR(format_posts, "report&, const string&, bool");
}
void format_posts::flush()
@@ -131,8 +131,6 @@ format_accounts::format_accounts(report_t& _report,
: report(_report), prepend_width(_prepend_width), disp_pred(),
first_report_title(true)
{
- TRACE_CTOR(format_accounts, "report&, const string&");
-
const char * f = format.c_str();
if (const char * p = std::strstr(f, "%/")) {
@@ -154,6 +152,8 @@ format_accounts::format_accounts(report_t& _report,
if (_prepend_format)
prepend_format.parse_format(*_prepend_format);
+
+ TRACE_CTOR(format_accounts, "report&, const string&");
}
std::size_t format_accounts::post_account(account_t& account, const bool flat)
diff --git a/src/pool.cc b/src/pool.cc
index be26de3b..61b5bef2 100644
--- a/src/pool.cc
+++ b/src/pool.cc
@@ -47,9 +47,9 @@ commodity_pool_t::commodity_pool_t()
quote_leeway(86400), get_quotes(false),
get_commodity_quote(commodity_quote_from_script)
{
- TRACE_CTOR(commodity_pool_t, "");
null_commodity = create("");
null_commodity->add_flags(COMMODITY_BUILTIN | COMMODITY_NOMARKET);
+ TRACE_CTOR(commodity_pool_t, "");
}
commodity_t * commodity_pool_t::create(const string& symbol)
diff --git a/src/post.h b/src/post.h
index d6004c9f..76a89a33 100644
--- a/src/post.h
+++ b/src/post.h
@@ -96,8 +96,8 @@ public:
assigned_amount(post.assigned_amount),
xdata_(post.xdata_)
{
- TRACE_CTOR(post_t, "copy");
copy_details(post);
+ TRACE_CTOR(post_t, "copy");
}
virtual ~post_t() {
TRACE_DTOR(post_t);
diff --git a/src/pstream.h b/src/pstream.h
index dfb27056..6e38158a 100644
--- a/src/pstream.h
+++ b/src/pstream.h
@@ -58,14 +58,14 @@ class ptristream : public std::istream
public:
ptrinbuf(char * _ptr, std::size_t _len) : ptr(_ptr), len(_len) {
- TRACE_CTOR(ptrinbuf, "char *, std::size_t");
-
if (*ptr && len == 0)
len = std::strlen(ptr);
- setg(ptr, // beginning of putback area
- ptr, // read position
+ setg(ptr, // beginning of putback area
+ ptr, // read position
ptr+len); // end position
+
+ TRACE_CTOR(ptrinbuf, "char *, std::size_t");
}
~ptrinbuf() throw() {
TRACE_DTOR(ptrinbuf);
diff --git a/src/pyfstream.h b/src/pyfstream.h
index 972f976f..18f28bc4 100644
--- a/src/pyfstream.h
+++ b/src/pyfstream.h
@@ -86,8 +86,8 @@ protected:
public:
pyofstream (PyFileObject * fo) : std::ostream(0), buf(fo) {
- TRACE_CTOR(pyofstream, "PyFileObject *");
rdbuf(&buf);
+ TRACE_CTOR(pyofstream, "PyFileObject *");
}
~pyofstream() throw() {
TRACE_DTOR(pyofstream);
@@ -121,11 +121,11 @@ public:
* => force underflow()
*/
pyinbuf (PyFileObject * _fo) : fo(_fo) {
- TRACE_CTOR(pyinbuf, "PyFileObject *");
-
setg (buffer+pbSize, // beginning of putback area
buffer+pbSize, // read position
buffer+pbSize); // end position
+
+ TRACE_CTOR(pyinbuf, "PyFileObject *");
}
~pyinbuf() throw() {
TRACE_DTOR(pyinbuf);
@@ -191,8 +191,8 @@ protected:
public:
pyifstream (PyFileObject * fo) : std::istream(0), buf(fo) {
- TRACE_CTOR(pyifstream, "PyFileObject *");
rdbuf(&buf);
+ TRACE_CTOR(pyifstream, "PyFileObject *");
}
~pyifstream() throw() {
TRACE_DTOR(pyifstream);
diff --git a/src/query.h b/src/query.h
index c694d099..fe52eb35 100644
--- a/src/query.h
+++ b/src/query.h
@@ -204,10 +204,11 @@ public:
consume_whitespace(false), consume_next_arg(false),
multiple_args(_multiple_args)
{
- TRACE_CTOR(query_t::lexer_t, "");
assert(begin != end);
arg_i = (*begin).as_string().begin();
arg_end = (*begin).as_string().end();
+
+ TRACE_CTOR(query_t::lexer_t, "");
}
lexer_t(const lexer_t& lexer)
: begin(lexer.begin), end(lexer.end),
@@ -302,18 +303,19 @@ public:
query_t(const string& arg,
const keep_details_t& what_to_keep = keep_details_t(),
bool multiple_args = true) {
- TRACE_CTOR(query_t, "string, keep_details_t, bool");
if (! arg.empty()) {
value_t temp(string_value(arg));
parse_args(temp.to_sequence(), what_to_keep, multiple_args);
}
+ TRACE_CTOR(query_t, "string, keep_details_t, bool");
}
query_t(const value_t& args,
const keep_details_t& what_to_keep = keep_details_t(),
bool multiple_args = true) {
- TRACE_CTOR(query_t, "value_t, keep_details_t, bool");
if (! args.empty())
parse_args(args, what_to_keep, multiple_args);
+
+ TRACE_CTOR(query_t, "value_t, keep_details_t, bool");
}
virtual ~query_t() {
TRACE_DTOR(query_t);
diff --git a/src/scope.h b/src/scope.h
index 9318fc5c..acaf7194 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -209,9 +209,9 @@ public:
explicit bind_scope_t(scope_t& _parent,
scope_t& _grandchild)
: child_scope_t(_parent), grandchild(_grandchild) {
- TRACE_CTOR(bind_scope_t, "scope_t&, scope_t&");
DEBUG("scope.symbols",
"Binding scope " << &_parent << " with " << &_grandchild);
+ TRACE_CTOR(bind_scope_t, "scope_t&, scope_t&");
}
virtual ~bind_scope_t() {
TRACE_DTOR(bind_scope_t);
diff --git a/src/session.cc b/src/session.cc
index 5c9e4fd4..9a77d341 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -62,14 +62,14 @@ void set_session_context(session_t * session)
session_t::session_t()
: flush_on_next_data_file(false), journal(new journal_t)
{
- TRACE_CTOR(session_t, "");
-
if (const char * home_var = std::getenv("HOME"))
HANDLER(price_db_).on(none, (path(home_var) / ".pricedb").string());
else
HANDLER(price_db_).on(none, path("./.pricedb").string());
parsing_context.push();
+
+ TRACE_CTOR(session_t, "");
}
std::size_t session_t::read_data(const string& master_account)
diff --git a/src/times.h b/src/times.h
index e3134665..3bb95903 100644
--- a/src/times.h
+++ b/src/times.h
@@ -307,13 +307,14 @@ public:
}
date_specifier_t(const date_t& date,
const optional<date_traits_t>& traits = none) {
- TRACE_CTOR(date_specifier_t, "date_t, date_traits_t");
if (! traits || traits->has_year)
year = date.year();
if (! traits || traits->has_month)
month = date.month();
if (! traits || traits->has_day)
day = date.day();
+
+ TRACE_CTOR(date_specifier_t, "date_t, date_traits_t");
}
date_specifier_t(const date_specifier_t& other)
: year(other.year), month(other.month),
@@ -538,8 +539,8 @@ public:
TRACE_CTOR(date_interval_t, "");
}
date_interval_t(const string& str) : aligned(false) {
- TRACE_CTOR(date_interval_t, "const string&");
parse(str);
+ TRACE_CTOR(date_interval_t, "const string&");
}
date_interval_t(const date_interval_t& other)
: range(other.range),
diff --git a/src/unistring.h b/src/unistring.h
index a33c6e3f..b2278796 100644
--- a/src/unistring.h
+++ b/src/unistring.h
@@ -64,14 +64,14 @@ public:
}
unistring(const std::string& input)
{
- TRACE_CTOR(unistring, "std::string");
-
const char * p = input.c_str();
std::size_t len = input.length();
assert(len < 1024);
VERIFY(utf8::is_valid(p, p + len));
utf8::unchecked::utf8to32(p, p + len, std::back_inserter(utf32chars));
+
+ TRACE_CTOR(unistring, "std::string");
}
~unistring() {
TRACE_DTOR(unistring);
diff --git a/src/utils.cc b/src/utils.cc
index 5a364008..17118904 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -278,16 +278,18 @@ namespace {
buf << num;
+ string number(buf.str());
+
int integer_digits = 0;
// Count the number of integer digits
- for (const char * p = buf.str().c_str(); *p; p++) {
+ for (const char * p = number.c_str(); *p; p++) {
if (*p == '.')
break;
else if (*p != '-')
integer_digits++;
}
- for (const char * p = buf.str().c_str(); *p; p++) {
+ for (const char * p = number.c_str(); *p; p++) {
if (*p == '.') {
obuf << *p;
assert(integer_digits <= 3);
@@ -335,7 +337,7 @@ namespace {
void report_count_map(std::ostream& out, object_count_map& the_map)
{
foreach (object_count_map::value_type& pair, the_map) {
- out << " " << std::right << std::setw(12);
+ out << " " << std::right << std::setw(18);
stream_commified_number(out, pair.second.first);
out << " " << std::right << std::setw(7);
stream_memory_size(out, pair.second.second);
@@ -433,7 +435,7 @@ void report_memory(std::ostream& out, bool report_all)
out << "Live memory:" << std::endl;
foreach (const memory_map::value_type& pair, *live_memory) {
- out << " " << std::right << std::setw(12) << pair.first
+ out << " " << std::right << std::setw(18) << pair.first
<< " " << std::right << std::setw(7);
stream_memory_size(out, pair.second.second);
out << " " << std::left << pair.second.first
@@ -455,7 +457,7 @@ void report_memory(std::ostream& out, bool report_all)
out << "Live objects:" << std::endl;
foreach (const objects_map::value_type& pair, *live_objects) {
- out << " " << std::right << std::setw(12) << pair.first
+ out << " " << std::right << std::setw(18) << pair.first
<< " " << std::right << std::setw(7);
stream_memory_size(out, pair.second.second);
out << " " << std::left << pair.second.first
diff --git a/src/value.h b/src/value.h
index a95968c2..d128bb89 100644
--- a/src/value.h
+++ b/src/value.h
@@ -179,8 +179,8 @@ public:
*/
explicit storage_t(const storage_t& rhs)
: type(rhs.type), refc(0) {
- TRACE_CTOR(value_t::storage_t, "copy");
*this = rhs;
+ TRACE_CTOR(value_t::storage_t, "copy");
}
storage_t& operator=(const storage_t& rhs);
@@ -290,73 +290,75 @@ public:
}
value_t(const bool val) {
- TRACE_CTOR(value_t, "const bool");
set_boolean(val);
+ TRACE_CTOR(value_t, "const bool");
}
value_t(const datetime_t& val) {
- TRACE_CTOR(value_t, "const datetime_t&");
set_datetime(val);
+ TRACE_CTOR(value_t, "const datetime_t&");
}
value_t(const date_t& val) {
- TRACE_CTOR(value_t, "const date_t&");
set_date(val);
+ TRACE_CTOR(value_t, "const date_t&");
}
value_t(const long val) {
- TRACE_CTOR(value_t, "const long");
set_long(val);
+ TRACE_CTOR(value_t, "const long");
}
value_t(const unsigned long val) {
- TRACE_CTOR(value_t, "const unsigned long");
set_amount(val);
+ TRACE_CTOR(value_t, "const unsigned long");
}
value_t(const double val) {
- TRACE_CTOR(value_t, "const double");
set_amount(val);
+ TRACE_CTOR(value_t, "const double");
}
value_t(const amount_t& val) {
- TRACE_CTOR(value_t, "const amount_t&");
set_amount(val);
+ TRACE_CTOR(value_t, "const amount_t&");
}
value_t(const balance_t& val) {
- TRACE_CTOR(value_t, "const balance_t&");
set_balance(val);
+ TRACE_CTOR(value_t, "const balance_t&");
}
value_t(const mask_t& val) {
- TRACE_CTOR(value_t, "const mask_t&");
set_mask(val);
+ TRACE_CTOR(value_t, "const mask_t&");
}
explicit value_t(const string& val, bool literal = false) {
- TRACE_CTOR(value_t, "const string&, bool");
if (literal)
set_string(val);
else
set_amount(amount_t(val));
+
+ TRACE_CTOR(value_t, "const string&, bool");
}
explicit value_t(const char * val, bool literal = false) {
- TRACE_CTOR(value_t, "const char *");
if (literal)
set_string(val);
else
set_amount(amount_t(val));
+
+ TRACE_CTOR(value_t, "const char *");
}
value_t(const sequence_t& val) {
- TRACE_CTOR(value_t, "const sequence_t&");
set_sequence(val);
+ TRACE_CTOR(value_t, "const sequence_t&");
}
explicit value_t(scope_t * item) {
- TRACE_CTOR(value_t, "scope_t *");
set_scope(item);
+ TRACE_CTOR(value_t, "scope_t *");
}
#if 0
template <typename T>
explicit value_t(T& item) {
- TRACE_CTOR(value_t, "T&");
set_any(item);
+ TRACE_CTOR(value_t, "T&");
}
#endif
@@ -375,8 +377,8 @@ public:
* object. A true copy is only ever made prior to modification.
*/
value_t(const value_t& val) {
- TRACE_CTOR(value_t, "copy");
*this = val;
+ TRACE_CTOR(value_t, "copy");
}
value_t& operator=(const value_t& val) {
if (! (this == &val || storage == val.storage))