diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-05 17:46:42 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-05 17:46:42 -0600 |
commit | b6adc8f4605befc2e6a91dfa28cc9237fb391fbc (patch) | |
tree | 2b6858bca43af8dca6c4569e2c14d34e1396b9d4 /src | |
parent | 477a9106e3788b33863a7701466860eb5f9682e3 (diff) | |
download | fork-ledger-b6adc8f4605befc2e6a91dfa28cc9237fb391fbc.tar.gz fork-ledger-b6adc8f4605befc2e6a91dfa28cc9237fb391fbc.tar.bz2 fork-ledger-b6adc8f4605befc2e6a91dfa28cc9237fb391fbc.zip |
Use unique_ptr instead of std::auto_ptr
Diffstat (limited to 'src')
-rw-r--r-- | src/amount.cc | 4 | ||||
-rw-r--r-- | src/csv.cc | 4 | ||||
-rw-r--r-- | src/draft.cc | 4 | ||||
-rw-r--r-- | src/format.cc | 2 | ||||
-rw-r--r-- | src/main.cc | 2 | ||||
-rw-r--r-- | src/report.cc | 2 | ||||
-rw-r--r-- | src/session.h | 4 | ||||
-rw-r--r-- | src/textual.cc | 10 | ||||
-rw-r--r-- | src/timelog.cc | 2 |
9 files changed, 17 insertions, 17 deletions
diff --git a/src/amount.cc b/src/amount.cc index 9704dd21..3ddb7672 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -1027,12 +1027,12 @@ bool amount_t::parse(std::istream& in, const parse_flags_t& flags) } // Allocate memory for the amount's quantity value. We have to - // monitor the allocation in an auto_ptr because this function gets + // monitor the allocation in a unique_ptr because this function gets // called sometimes from amount_t's constructor; and if there is an // exeception thrown by any of the function calls after this point, // the destructor will never be called and the memory never freed. - std::auto_ptr<bigint_t> new_quantity; + unique_ptr<bigint_t> new_quantity; if (quantity) { if (quantity->refc > 1) @@ -139,8 +139,8 @@ xact_t * csv_reader::read_xact(bool rich_data) std::istringstream instr(line); - std::auto_ptr<xact_t> xact(new xact_t); - std::auto_ptr<post_t> post(new post_t); + unique_ptr<xact_t> xact(new xact_t); + unique_ptr<post_t> post(new post_t); xact->set_state(item_t::CLEARED); diff --git a/src/draft.cc b/src/draft.cc index 7c95caf7..017c637d 100644 --- a/src/draft.cc +++ b/src/draft.cc @@ -233,7 +233,7 @@ xact_t * draft_t::insert(journal_t& journal) throw std::runtime_error(_("'xact' command requires at least a payee")); xact_t * matching = NULL; - std::auto_ptr<xact_t> added(new xact_t); + unique_ptr<xact_t> added(new xact_t); if (xact_t * xact = lookup_probable_account(tmpl->payee_mask.str(), journal.xacts.rbegin(), @@ -316,7 +316,7 @@ xact_t * draft_t::insert(journal_t& journal) } foreach (xact_template_t::post_template_t& post, tmpl->posts) { - std::auto_ptr<post_t> new_post; + unique_ptr<post_t> new_post; commodity_t * found_commodity = NULL; diff --git a/src/format.cc b/src/format.cc index 9824d5f7..d8c03e6a 100644 --- a/src/format.cc +++ b/src/format.cc @@ -125,7 +125,7 @@ namespace { format_t::element_t * format_t::parse_elements(const string& fmt, const optional<format_t&>& tmpl) { - std::auto_ptr<element_t> result; + unique_ptr<element_t> result; element_t * current = NULL; diff --git a/src/main.cc b/src/main.cc index aafbdbcb..dd03206f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -80,7 +80,7 @@ int main(int argc, char * argv[], char * envp[]) ::textdomain("ledger"); #endif - std::auto_ptr<global_scope_t> global_scope; + unique_ptr<global_scope_t> global_scope; try { // Create the session object, which maintains nearly all state relating to diff --git a/src/report.cc b/src/report.cc index 90f482cc..b86f77eb 100644 --- a/src/report.cc +++ b/src/report.cc @@ -309,7 +309,7 @@ void report_t::posts_report(post_handler_ptr handler) { handler = chain_post_handlers(handler, *this); if (HANDLED(group_by_)) { - std::auto_ptr<post_splitter> + unique_ptr<post_splitter> splitter(new post_splitter(handler, *this, HANDLER(group_by_).expr)); splitter->set_postflush_func(posts_flusher(handler, *this)); handler = post_handler_ptr(splitter.release()); diff --git a/src/session.h b/src/session.h index 879efeb6..cfeced39 100644 --- a/src/session.h +++ b/src/session.h @@ -59,8 +59,8 @@ class session_t : public symbol_scope_t public: bool flush_on_next_data_file; - std::auto_ptr<journal_t> journal; - parse_context_stack_t parsing_context; + unique_ptr<journal_t> journal; + parse_context_stack_t parsing_context; explicit session_t(); virtual ~session_t() { diff --git a/src/textual.cc b/src/textual.cc index 95635184..2493dc0d 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -527,7 +527,7 @@ void instance_t::automated_xact_directive(char * line) query.parse_args(string_value(skip_ws(line + 1)).to_sequence(), keeper, false, true); - std::auto_ptr<auto_xact_t> ae(new auto_xact_t(predicate_t(expr, keeper))); + unique_ptr<auto_xact_t> ae(new auto_xact_t(predicate_t(expr, keeper))); ae->pos = position_t(); ae->pos->pathname = context.pathname; ae->pos->beg_pos = context.line_beg_pos; @@ -621,7 +621,7 @@ void instance_t::period_xact_directive(char * line) try { - std::auto_ptr<period_xact_t> pe(new period_xact_t(skip_ws(line + 1))); + unique_ptr<period_xact_t> pe(new period_xact_t(skip_ws(line + 1))); pe->pos = position_t(); pe->pos->pathname = context.pathname; pe->pos->beg_pos = context.line_beg_pos; @@ -665,7 +665,7 @@ void instance_t::xact_directive(char * line, std::streamsize len) TRACE_START(xacts, 1, "Time spent handling transactions:"); if (xact_t * xact = parse_xact(line, len, top_account())) { - std::auto_ptr<xact_t> manager(xact); + unique_ptr<xact_t> manager(xact); if (context.journal->add_xact(xact)) { manager.release(); // it's owned by the journal now @@ -874,7 +874,7 @@ void instance_t::account_directive(char * line) char * p = skip_ws(line); account_t * account = context.journal->register_account(p, NULL, top_account()); - std::auto_ptr<auto_xact_t> ae; + unique_ptr<auto_xact_t> ae; while (peek_whitespace_line()) { read_line(line); @@ -1287,7 +1287,7 @@ post_t * instance_t::parse_post(char * line, { TRACE_START(post_details, 1, "Time spent parsing postings:"); - std::auto_ptr<post_t> post(new post_t); + unique_ptr<post_t> post(new post_t); post->xact = xact; // this could be NULL post->pos = position_t(); diff --git a/src/timelog.cc b/src/timelog.cc index 67ea1015..b46d3922 100644 --- a/src/timelog.cc +++ b/src/timelog.cc @@ -88,7 +88,7 @@ namespace { if (! out_event.note.empty() && event.note.empty()) event.note = out_event.note; - std::auto_ptr<xact_t> curr(new xact_t); + unique_ptr<xact_t> curr(new xact_t); curr->_date = event.checkin.date(); curr->code = out_event.desc; // if it wasn't used above curr->payee = event.desc; |