From f0a2f0d70e26bc757d5ef4fa313c5027188ee762 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 8 Sep 2014 00:06:41 -0400 Subject: [PATCH] Context - Restructured code that handles initialization failure, which was checking the rc value at each step, which is not necessary and confusing. --- src/Context.cpp | 71 +++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index de8736310..8063336ad 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -225,43 +225,44 @@ int Context::initialize (int argc, const char** argv) rc = 3; } - // Dump all debug messages, controlled by rc.debug. - if (rc && config.getBoolean ("debug")) - { - std::vector ::iterator d; - for (d = debugMessages.begin (); d != debugMessages.end (); ++d) - if (color ()) - std::cerr << colorizeDebug (*d) << "\n"; - else - std::cerr << *d << "\n"; - } - - // Dump all headers, controlled by 'header' verbosity token. - if (rc && verbose ("header")) - { - std::vector ::iterator h; - for (h = headers.begin (); h != headers.end (); ++h) - if (color ()) - std::cerr << colorizeHeader (*h) << "\n"; - else - std::cerr << *h << "\n"; - } - - // Dump all footnotes, controlled by 'footnote' verbosity token. - if (rc && verbose ("footnote")) - { - std::vector ::iterator f; - for (f = footnotes.begin (); f != footnotes.end (); ++f) - if (color ()) - std::cerr << colorizeFootnote (*f) << "\n"; - else - std::cerr << *f << "\n"; - } - - // Dump all errors, non-maskable. - // Colorized as footnotes. + // On initialization failure... if (rc) { + // Dump all debug messages, controlled by rc.debug. + if (config.getBoolean ("debug")) + { + std::vector ::iterator d; + for (d = debugMessages.begin (); d != debugMessages.end (); ++d) + if (color ()) + std::cerr << colorizeDebug (*d) << "\n"; + else + std::cerr << *d << "\n"; + } + + // Dump all headers, controlled by 'header' verbosity token. + if (verbose ("header")) + { + std::vector ::iterator h; + for (h = headers.begin (); h != headers.end (); ++h) + if (color ()) + std::cerr << colorizeHeader (*h) << "\n"; + else + std::cerr << *h << "\n"; + } + + // Dump all footnotes, controlled by 'footnote' verbosity token. + if (verbose ("footnote")) + { + std::vector ::iterator f; + for (f = footnotes.begin (); f != footnotes.end (); ++f) + if (color ()) + std::cerr << colorizeFootnote (*f) << "\n"; + else + std::cerr << *f << "\n"; + } + + // Dump all errors, non-maskable. + // Colorized as footnotes. std::vector ::iterator e; for (e = errors.begin (); e != errors.end (); ++e) if (color ())