Merge pull request #911 from uburuntu/master

ENH: perfomance: using clear() and empty() more faster
This commit is contained in:
Daniel Marjamäki 2017-06-03 11:07:36 +02:00 committed by GitHub
commit 1dd1b5606c
6 changed files with 8 additions and 8 deletions

View File

@ -1645,7 +1645,7 @@ MathLib::biguint CheckBufferOverrun::countSprintfLength(const std::string &input
input_string_size += tempDigits; input_string_size += tempDigits;
parameterLength = 0; parameterLength = 0;
digits_string = ""; digits_string.clear();
i_d_x_f_found = false; i_d_x_f_found = false;
percentCharFound = false; percentCharFound = false;
handleNextParameter = false; handleNextParameter = false;

View File

@ -610,7 +610,7 @@ void CheckStl::pushback()
} else { } else {
vectorid = 0; vectorid = 0;
} }
invalidIterator = ""; invalidIterator.clear();
} }
// push_back on vector.. // push_back on vector..

View File

@ -176,7 +176,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
if (funcToken->str()==",") { if (funcToken->str()==",") {
if (++index == argIndex) if (++index == argIndex)
break; break;
value = ""; value.clear();
} else } else
value += funcToken->str(); value += funcToken->str();
funcToken = funcToken->next(); funcToken = funcToken->next();

View File

@ -72,7 +72,7 @@ Library::Error Library::load(const char exename[], const char path[])
if (error == tinyxml2::XML_ERROR_FILE_NOT_FOUND) { if (error == tinyxml2::XML_ERROR_FILE_NOT_FOUND) {
// failed to open file.. is there no extension? // failed to open file.. is there no extension?
std::string fullfilename(path); std::string fullfilename(path);
if (Path::getFilenameExtension(fullfilename) == "") { if (Path::getFilenameExtension(fullfilename).empty()) {
fullfilename += ".cfg"; fullfilename += ".cfg";
error = doc.LoadFile(fullfilename.c_str()); error = doc.LoadFile(fullfilename.c_str());
if (error != tinyxml2::XML_ERROR_FILE_NOT_FOUND) if (error != tinyxml2::XML_ERROR_FILE_NOT_FOUND)

View File

@ -84,7 +84,7 @@ std::string Path::simplifyPath(std::string originalPath)
if (originalPath[i] == '/' || originalPath[i] == '\\') { if (originalPath[i] == '/' || originalPath[i] == '\\') {
if (subPath.length() > 0) { if (subPath.length() > 0) {
pathParts.push_back(subPath); pathParts.push_back(subPath);
subPath = ""; subPath.clear();
} }
pathParts.push_back(std::string(1 , originalPath[i])); pathParts.push_back(std::string(1 , originalPath[i]));

View File

@ -4782,7 +4782,7 @@ bool Tokenizer::simplifyConditions()
// It is inconclusive whether two unequal float representations are numerically equal // It is inconclusive whether two unequal float representations are numerically equal
if (!eq && MathLib::isFloat(op1)) if (!eq && MathLib::isFloat(op1))
cmp = ""; cmp.clear();
} }
if (cmp == "==") if (cmp == "==")
@ -4801,7 +4801,7 @@ bool Tokenizer::simplifyConditions()
else if (cmp == "<") else if (cmp == "<")
result = (op1 < op2); result = (op1 < op2);
else else
cmp = ""; cmp.clear();
} }
} else { } else {
// Compare boolean // Compare boolean
@ -4821,7 +4821,7 @@ bool Tokenizer::simplifyConditions()
else if (cmp == "<") else if (cmp == "<")
result = (op1 < op2); result = (op1 < op2);
else else
cmp = ""; cmp.clear();
} }
if (! cmp.empty()) { if (! cmp.empty()) {