Simplify token string access
"internal" check reported: [lib/tokenize.cpp:6671]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
This commit is contained in:
parent
5c8b05ce94
commit
f4227967ce
|
@ -6668,7 +6668,7 @@ void Tokenizer::simplifyCharAt()
|
|||
// Replace "string"[0] with 's'
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "%str% [ %num% ]")) {
|
||||
const MathLib::bigint index = MathLib::toLongNumber(tok->tokAt(2)->str());
|
||||
const MathLib::bigint index = MathLib::toLongNumber(tok->strAt(2));
|
||||
// Check within range
|
||||
if (index >= 0 && index <= (MathLib::bigint)Token::getStrLength(tok)) {
|
||||
tok->str(std::string("'" + Token::getCharAt(tok, (size_t)index) + "'"));
|
||||
|
|
Loading…
Reference in New Issue