From cb84b88cb17b460c9052bc2243219ecf38395923 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 3 Dec 2015 14:20:46 +0300 Subject: [PATCH] Better variable names, more linear code --- lib/preprocessor.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 29e408146..950273ae3 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1812,16 +1812,18 @@ std::string Preprocessor::getcode(const std::string &filedata, const std::string typedef std::set::const_iterator It; for (It it = _settings.userUndefs.begin(); it != _settings.userUndefs.end(); ++it) { - std::string::size_type pos = line.find_first_not_of(' ',8); - if (pos != std::string::npos) { - std::string::size_type pos2 = line.find(*it,pos); - if ((pos2 != std::string::npos) && - ((line.size() == pos2 + (*it).size()) || - (line[pos2 + (*it).size()] == ' ') || - (line[pos2 + (*it).size()] == '('))) { - match = false; - break; - } + const std::string::size_type symbolPos = line.find_first_not_of(' ', 8); + if (symbolPos == std::string::npos) + continue; + const std::string::size_type undefMatchPos = line.find(*it, symbolPos); + if (undefMatchPos == std::string::npos) + continue; + const std::string::size_type behindUndefPos = undefMatchPos + (*it).size(); + if ((line.size() == behindUndefPos) || + (line[behindUndefPos] == ' ') || + (line[behindUndefPos] == '(')) { + match = false; + break; } }