From cdecbe29d0c2a3ba59e0531ba5213ec546c646a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 26 Sep 2010 15:54:41 +0200 Subject: [PATCH] Optimisation: Made Tokenizer::simplifyInitVar faster --- lib/tokenize.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d5adfb82f..39564d9aa 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5603,13 +5603,13 @@ void Tokenizer::simplifyInitVar() { for (Token *tok = _tokens; tok; tok = tok->next()) { - if (Token::Match(tok, "{|}|;| class|struct|union| %type% *| %var% ( &| %any% ) ;") || - Token::Match(tok, "{|}|;| %type% *| %var% ( %type% (")) + if (!tok->isName() || (tok->previous() && !Token::Match(tok->previous(), "[;{}]"))) + continue; + + if (Token::Match(tok, "class|struct|union| %type% *| %var% ( &| %any% ) ;") || + Token::Match(tok, "%type% *| %var% ( %type% (")) { - if (Token::Match(tok, "[;{}]")) - tok = initVar(tok->next()); - else - tok = initVar(tok); + tok = initVar(tok); } } }