Skip to content

Commit cb84b88

Browse files
committed
Better variable names, more linear code
1 parent f624f6f commit cb84b88

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

lib/preprocessor.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,16 +1812,18 @@ std::string Preprocessor::getcode(const std::string &filedata, const std::string
18121812

18131813
typedef std::set<std::string>::const_iterator It;
18141814
for (It it = _settings.userUndefs.begin(); it != _settings.userUndefs.end(); ++it) {
1815-
std::string::size_type pos = line.find_first_not_of(' ',8);
1816-
if (pos != std::string::npos) {
1817-
std::string::size_type pos2 = line.find(*it,pos);
1818-
if ((pos2 != std::string::npos) &&
1819-
((line.size() == pos2 + (*it).size()) ||
1820-
(line[pos2 + (*it).size()] == ' ') ||
1821-
(line[pos2 + (*it).size()] == '('))) {
1822-
match = false;
1823-
break;
1824-
}
1815+
const std::string::size_type symbolPos = line.find_first_not_of(' ', 8);
1816+
if (symbolPos == std::string::npos)
1817+
continue;
1818+
const std::string::size_type undefMatchPos = line.find(*it, symbolPos);
1819+
if (undefMatchPos == std::string::npos)
1820+
continue;
1821+
const std::string::size_type behindUndefPos = undefMatchPos + (*it).size();
1822+
if ((line.size() == behindUndefPos) ||
1823+
(line[behindUndefPos] == ' ') ||
1824+
(line[behindUndefPos] == '(')) {
1825+
match = false;
1826+
break;
18251827
}
18261828
}
18271829

0 commit comments

Comments
 (0)