From 2989f708988a42491bd15b233773db8b0f4e8834 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 14 Jul 2014 11:44:58 +0400 Subject: [PATCH] Get rid of tokAt() and strAt() in trivial cases. --- lib/checkassert.cpp | 2 +- lib/symboldatabase.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/checkassert.cpp b/lib/checkassert.cpp index 45beda62b..ac30bfb90 100644 --- a/lib/checkassert.cpp +++ b/lib/checkassert.cpp @@ -40,7 +40,7 @@ void CheckAssert::assertWithSideEffects() const Token *endTok = tok ? tok->next()->link() : nullptr; while (tok && endTok) { - for (const Token* tmp = tok->tokAt(1); tmp != endTok; tmp = tmp->next()) { + for (const Token* tmp = tok->next(); tmp != endTok; tmp = tmp->next()) { checkVariableAssignment(tmp, true); if (tmp->isName() && tmp->type() == Token::eFunction) { diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 85855f6d2..7e03a14da 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -104,7 +104,10 @@ public: } const std::string& name() const { - return classDef->next()->isName() ? classDef->strAt(1) : emptyString; + const Token* next = classDef->next(); + if (next->isName()) + return next->str(); + return emptyString; } const Token *initBaseInfo(const Token *tok, const Token *tok1);