From 1a0b59efd4f89b49e04d50a45f41923a2173d278 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 14 Feb 2013 01:03:05 +0000 Subject: [PATCH] Eliminated unnecessary variable shadowing in write_logfile --- src/base/application.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/base/application.cpp b/src/base/application.cpp index f721288c0..459787b01 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -269,17 +269,10 @@ void Application::Messages::write_logfile(const std::string& file) // can be appended to the name to create the name of a file // that does not exist. std::string fname = nm + ext; - std::ifstream f(fname.c_str()); - if (f) { - int n = 0; - while (1 > 0) { - n++; - fname = nm + int2str(n) + ext; - std::ifstream f(fname.c_str()); - if (!f) { - break; - } - } + int n = 0; + while (std::ifstream(fname.c_str())) { + n++; + fname = nm + int2str(n) + ext; } // Now we have a file name that does not correspond to any