Refactorization: Use std::string::pop_back
Merged from LCppC.
This commit is contained in:
parent
2fa2fec24f
commit
ef82897af5
|
@ -257,7 +257,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
||||||
else if (std::strncmp(argv[i], "--cppcheck-build-dir=", 21) == 0) {
|
else if (std::strncmp(argv[i], "--cppcheck-build-dir=", 21) == 0) {
|
||||||
mSettings->buildDir = Path::fromNativeSeparators(argv[i] + 21);
|
mSettings->buildDir = Path::fromNativeSeparators(argv[i] + 21);
|
||||||
if (endsWith(mSettings->buildDir, '/'))
|
if (endsWith(mSettings->buildDir, '/'))
|
||||||
mSettings->buildDir.erase(mSettings->buildDir.size() - 1U);
|
mSettings->buildDir.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show --debug output after the first simplifications
|
// Show --debug output after the first simplifications
|
||||||
|
|
|
@ -561,7 +561,7 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
|
||||||
portabilityBackslash(outputList, files, location);
|
portabilityBackslash(outputList, files, location);
|
||||||
if (currentToken[currentToken.size() - 1U] == '\\') {
|
if (currentToken[currentToken.size() - 1U] == '\\') {
|
||||||
++multiline;
|
++multiline;
|
||||||
currentToken.erase(currentToken.size() - 1U);
|
currentToken.pop_back();
|
||||||
} else {
|
} else {
|
||||||
ungetChar(istr, bom);
|
ungetChar(istr, bom);
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
|
||||||
if (ch == '\"' && !prefix.empty() && *cback()->str().rbegin() == 'R') {
|
if (ch == '\"' && !prefix.empty() && *cback()->str().rbegin() == 'R') {
|
||||||
std::string delim;
|
std::string delim;
|
||||||
currentToken = ch;
|
currentToken = ch;
|
||||||
prefix.resize(prefix.size() - 1);
|
prefix.pop_back();
|
||||||
ch = readChar(istr,bom);
|
ch = readChar(istr,bom);
|
||||||
while (istr.good() && ch != '(' && ch != '\n') {
|
while (istr.good() && ch != '(' && ch != '\n') {
|
||||||
delim += ch;
|
delim += ch;
|
||||||
|
@ -1147,7 +1147,7 @@ std::string simplecpp::TokenList::readUntil(std::istream &istr, const Location &
|
||||||
do {
|
do {
|
||||||
next = readChar(istr, bom);
|
next = readChar(istr, bom);
|
||||||
if (next == '\r' || next == '\n') {
|
if (next == '\r' || next == '\n') {
|
||||||
ret.erase(ret.size()-1U);
|
ret.pop_back();
|
||||||
backslash = (next == '\r');
|
backslash = (next == '\r');
|
||||||
update_ch = false;
|
update_ch = false;
|
||||||
} else if (next == '\\')
|
} else if (next == '\\')
|
||||||
|
@ -2176,7 +2176,7 @@ namespace simplecpp {
|
||||||
|
|
||||||
// remove trailing dot if path ends with "/."
|
// remove trailing dot if path ends with "/."
|
||||||
if (endsWith(path,"/."))
|
if (endsWith(path,"/."))
|
||||||
path.erase(path.size()-1);
|
path.pop_back();
|
||||||
|
|
||||||
// simplify ".."
|
// simplify ".."
|
||||||
pos = 1; // don't simplify ".." if path starts with that
|
pos = 1; // don't simplify ".." if path starts with that
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool Token::isUpperCaseName() const
|
||||||
|
|
||||||
void Token::concatStr(std::string const& b)
|
void Token::concatStr(std::string const& b)
|
||||||
{
|
{
|
||||||
mStr.erase(mStr.length() - 1);
|
mStr.pop_back();
|
||||||
mStr.append(getStringLiteral(b) + "\"");
|
mStr.append(getStringLiteral(b) + "\"");
|
||||||
|
|
||||||
if (isCChar() && isStringLiteral(b) && b[0] != '"') {
|
if (isCChar() && isStringLiteral(b) && b[0] != '"') {
|
||||||
|
|
Loading…
Reference in New Issue