Skip to content

Commit ef82897

Browse files
PKEuSdanmar
authored andcommitted
Refactorization: Use std::string::pop_back
Merged from LCppC.
1 parent 2fa2fec commit ef82897

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

cli/cmdlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
257257
else if (std::strncmp(argv[i], "--cppcheck-build-dir=", 21) == 0) {
258258
mSettings->buildDir = Path::fromNativeSeparators(argv[i] + 21);
259259
if (endsWith(mSettings->buildDir, '/'))
260-
mSettings->buildDir.erase(mSettings->buildDir.size() - 1U);
260+
mSettings->buildDir.pop_back();
261261
}
262262

263263
// Show --debug output after the first simplifications

externals/simplecpp/simplecpp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
561561
portabilityBackslash(outputList, files, location);
562562
if (currentToken[currentToken.size() - 1U] == '\\') {
563563
++multiline;
564-
currentToken.erase(currentToken.size() - 1U);
564+
currentToken.pop_back();
565565
} else {
566566
ungetChar(istr, bom);
567567
}
@@ -606,7 +606,7 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
606606
if (ch == '\"' && !prefix.empty() && *cback()->str().rbegin() == 'R') {
607607
std::string delim;
608608
currentToken = ch;
609-
prefix.resize(prefix.size() - 1);
609+
prefix.pop_back();
610610
ch = readChar(istr,bom);
611611
while (istr.good() && ch != '(' && ch != '\n') {
612612
delim += ch;
@@ -1147,7 +1147,7 @@ std::string simplecpp::TokenList::readUntil(std::istream &istr, const Location &
11471147
do {
11481148
next = readChar(istr, bom);
11491149
if (next == '\r' || next == '\n') {
1150-
ret.erase(ret.size()-1U);
1150+
ret.pop_back();
11511151
backslash = (next == '\r');
11521152
update_ch = false;
11531153
} else if (next == '\\')
@@ -2176,7 +2176,7 @@ namespace simplecpp {
21762176

21772177
// remove trailing dot if path ends with "/."
21782178
if (endsWith(path,"/."))
2179-
path.erase(path.size()-1);
2179+
path.pop_back();
21802180

21812181
// simplify ".."
21822182
pos = 1; // don't simplify ".." if path starts with that

lib/token.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool Token::isUpperCaseName() const
175175

176176
void Token::concatStr(std::string const& b)
177177
{
178-
mStr.erase(mStr.length() - 1);
178+
mStr.pop_back();
179179
mStr.append(getStringLiteral(b) + "\"");
180180

181181
if (isCChar() && isStringLiteral(b) && b[0] != '"') {

0 commit comments

Comments
 (0)