diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 99dc3f0a9..6c9eba245 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1410,7 +1410,7 @@ public: bool renameMacroVariables(std::string &result, const PreprocessorMacro ¯o) { // No variables - if (_params.size() == 0) + if (_params.empty()) return false; // Already renamed @@ -1787,7 +1787,7 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file // leaving a file, update position.. else if (line == "#endfile") { - if (fileinfo.size()) + if (!fileinfo.empty()) { linenr = fileinfo.top().first; filename = fileinfo.top().second; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index fc084c89c..d79a2fd05 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -805,7 +805,7 @@ void Tokenizer::simplifyTypedef() } } -bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string configuration) +bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string &configuration) { _configuration = configuration; @@ -1950,7 +1950,7 @@ bool Tokenizer::createLinks() } else if (token->str() == "}") { - if (links.size() == 0) + if (links.empty()) { // Error, { and } don't match. syntaxError(token, '{'); @@ -1973,7 +1973,7 @@ bool Tokenizer::createLinks() } else if (token->str() == ")") { - if (links2.size() == 0) + if (links2.empty()) { // Error, ( and ) don't match. syntaxError(token, '('); @@ -1996,7 +1996,7 @@ bool Tokenizer::createLinks() } else if (token->str() == "]") { - if (links3.size() == 0) + if (links3.empty()) { // Error, [ and ] don't match. syntaxError(token, '['); @@ -2014,21 +2014,21 @@ bool Tokenizer::createLinks() } } - if (links.size() > 0) + if (!links.empty()) { // Error, { and } don't match. syntaxError(links.back(), '{'); return false; } - if (links2.size() > 0) + if (!links2.empty()) { // Error, ( and ) don't match. syntaxError(links2.back(), '('); return false; } - if (links3.size() > 0) + if (!links3.empty()) { // Error, [ and ] don't match. syntaxError(links3.back(), '['); @@ -4534,7 +4534,7 @@ void Tokenizer::simplifyGoto() } else if (token->str() == ")") { - if (links.size() == 0) + if (links.empty()) { // This should never happen at this point syntaxError(token, ')'); @@ -4550,7 +4550,7 @@ void Tokenizer::simplifyGoto() } else if (token->str() == "}") { - if (links2.size() == 0) + if (links2.empty()) { // This should never happen at this point syntaxError(token, '}'); @@ -4566,7 +4566,7 @@ void Tokenizer::simplifyGoto() } else if (token->str() == "]") { - if (links3.size() == 0) + if (links3.empty()) { // This should never happen at this point syntaxError(token, ']'); diff --git a/lib/tokenize.h b/lib/tokenize.h index 2f735e303..31cbfb1a6 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -67,7 +67,7 @@ public: * @param configuration E.g. "A" for code where "#ifdef A" is true * @return false if Source code contains syntax errors */ - bool tokenize(std::istream &code, const char FileName[], const std::string configuration = ""); + bool tokenize(std::istream &code, const char FileName[], const std::string &configuration = ""); /** * Create tokens from code.