From c0d7feac7f4af1b3535834f511e2e9ef2c2f7cb0 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 17 Aug 2004 02:43:09 -0400 Subject: don't allocate config_t within config.cc --- config.cc | 2 +- config.h | 20 ++++++++++---------- main.cc | 5 +++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/config.cc b/config.cc index 3a9ce1ac..99c4d4b4 100644 --- a/config.cc +++ b/config.cc @@ -3,7 +3,7 @@ namespace ledger { -std::auto_ptr config(new config_t); +config_t * config = NULL; const std::string bal_fmt = "%20T %2_%-n\n"; const std::string reg_fmt diff --git a/config.h b/config.h index c026bdec..a5319059 100644 --- a/config.h +++ b/config.h @@ -32,20 +32,20 @@ struct config_t std::string value_expr; std::string total_expr; unsigned long pricing_leeway; - bool show_subtotals; - bool show_expanded; - bool show_related; - bool show_inverted; - bool show_empty; - bool days_of_the_week; - bool show_revalued; - bool show_revalued_only; - bool download_quotes; + bool show_subtotals; + bool show_expanded; + bool show_related; + bool show_inverted; + bool show_empty; + bool days_of_the_week; + bool show_revalued; + bool show_revalued_only; + bool download_quotes; config_t(); }; -extern std::auto_ptr config; +extern config_t * config; void option_help(std::ostream& out); diff --git a/main.cc b/main.cc index 4223b3ff..d8d54567 100644 --- a/main.cc +++ b/main.cc @@ -35,6 +35,11 @@ int main(int argc, char * argv[], char * envp[]) { std::auto_ptr journal(new journal_t); + // Initialize the global configuration object for this run + + std::auto_ptr global_config(new config_t); + config = global_config.get(); + // Parse command-line arguments TIMER_START(process_args); -- cgit v1.2.3