From: Michal 'vorner' Vaner Date: Wed, 18 Jul 2012 14:41:12 +0000 (+0200) Subject: [2123] Scope of variables X-Git-Tag: trac2351_base~112^2~56 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24cad403c42d09f325f2c36f687c2cc4fbcb2a96;p=thirdparty%2Fkea.git [2123] Scope of variables --- diff --git a/src/lib/config/module_spec.cc b/src/lib/config/module_spec.cc index 98a991da69..781fed2eeb 100644 --- a/src/lib/config/module_spec.cc +++ b/src/lib/config/module_spec.cc @@ -476,9 +476,9 @@ ModuleSpec::validateSpecList(ConstElementPtr spec, ConstElementPtr data, typedef std::pair maptype; BOOST_FOREACH(maptype m, data->mapValue()) { - bool found = false; // Ignore 'version' as a config element if (m.first.compare("version") != 0) { + bool found = false; BOOST_FOREACH(ConstElementPtr cur_spec_el, spec->listValue()) { if (cur_spec_el->get("item_name")->stringValue().compare(m.first) == 0) { found = true; diff --git a/src/lib/util/filename.cc b/src/lib/util/filename.cc index d7da9c81d4..d6951dc94a 100644 --- a/src/lib/util/filename.cc +++ b/src/lib/util/filename.cc @@ -34,9 +34,9 @@ Filename::split(const string& full_name, string& directory, string& name, string& extension) const { directory = name = extension = ""; - bool dir_present = false; if (!full_name.empty()) { + bool dir_present = false; // Find the directory. size_t last_slash = full_name.find_last_of('/'); if (last_slash != string::npos) { diff --git a/src/lib/util/strutil.cc b/src/lib/util/strutil.cc index 89edcc9c75..8ed88cbfb2 100644 --- a/src/lib/util/strutil.cc +++ b/src/lib/util/strutil.cc @@ -39,10 +39,9 @@ normalizeSlash(std::string& name) { string trim(const string& instring) { - static const char* blanks = " \t\n"; - string retstring = ""; if (!instring.empty()) { + static const char* blanks = " \t\n"; // Search for first non-blank character in the string size_t first = instring.find_first_not_of(blanks);