From 76e48a5fc640c5331799734ca1bbc8fdb2af8fb9 Mon Sep 17 00:00:00 2001 From: Grzegorz Krajewski Date: Tue, 1 Mar 2016 21:45:44 +0100 Subject: [PATCH] Update prefixedoutstream_impl.hpp --- .../core/util/prefixedoutstream_impl.hpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mlpack/core/util/prefixedoutstream_impl.hpp b/src/mlpack/core/util/prefixedoutstream_impl.hpp index fd1f1644b0..8c6ccda2d1 100644 --- a/src/mlpack/core/util/prefixedoutstream_impl.hpp +++ b/src/mlpack/core/util/prefixedoutstream_impl.hpp @@ -67,31 +67,31 @@ void PrefixedOutStream::BaseLogic(const T& val) } // Now, we need to check for newlines in retrieved backtrace. - // If we find one, output up until the newline, then output the newline - // and the prefix and continue looking. + //If we find one, output up until the newline, then output the newline + //and the prefix and continue looking. size_t nl; size_t pos = 0; #ifdef HAS_BFD_DL - if(fatal) - { - Backtrace bt; - std::string btLine = bt.ToString(); - while ((nl = btLine.find('\n', pos)) != std::string::npos) + if(fatal) { - PrefixIfNeeded(); - - destination << btLine.substr(pos, nl - pos); - destination << std::endl; - newlined = true; + Backtrace bt; + std::string btLine = bt.ToString(); + while ((nl = btLine.find('\n', pos)) != std::string::npos) + { + PrefixIfNeeded(); - carriageReturned = true; // Regardless of whether or not we display it. - - pos = nl + 1; + destination << btLine.substr(pos, nl - pos); + destination << std::endl; + newlined = true; + + carriageReturned = true; // Regardless of whether or not we display it. + + pos = nl + 1; + } + pos = 0; } - } -#endif +#endif //The same logic like above, but this time for 'line'. - pos = 0; while ((nl = line.find('\n', pos)) != std::string::npos) { PrefixIfNeeded();