ENH: perfomance: using clear() and empty() more faster for stl containers

This commit is contained in:
uburuntu 2017-06-02 22:38:00 +04:00
parent dc83f6783e
commit f4ce49d883
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;
parameterLength = 0;
digits_string = "";
digits_string.clear();
i_d_x_f_found = false;
percentCharFound = false;
handleNextParameter = false;

View File

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

View File

@ -176,7 +176,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
if (funcToken->str()==",") {
if (++index == argIndex)
break;
value = "";
value.clear();
} else
value += funcToken->str();
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) {
// failed to open file.. is there no extension?
std::string fullfilename(path);
if (Path::getFilenameExtension(fullfilename) == "") {
if (Path::getFilenameExtension(fullfilename).empty()) {
fullfilename += ".cfg";
error = doc.LoadFile(fullfilename.c_str());
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 (subPath.length() > 0) {
pathParts.push_back(subPath);
subPath = "";
subPath.clear();
}
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
if (!eq && MathLib::isFloat(op1))
cmp = "";
cmp.clear();
}
if (cmp == "==")
@ -4801,7 +4801,7 @@ bool Tokenizer::simplifyConditions()
else if (cmp == "<")
result = (op1 < op2);
else
cmp = "";
cmp.clear();
}
} else {
// Compare boolean
@ -4821,7 +4821,7 @@ bool Tokenizer::simplifyConditions()
else if (cmp == "<")
result = (op1 < op2);
else
cmp = "";
cmp.clear();
}
if (! cmp.empty()) {