From 210f2ab35243b4f305fefe7e212440c05f795d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 16 Jun 2013 15:27:59 +0200 Subject: [PATCH] Tokenizer: refactoring; use Token::link() instead of loop --- lib/tokenize.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8ceec1b9d..31340aafe 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3585,20 +3585,8 @@ void Tokenizer::removeMacrosInGlobalScope() if (Token::Match(tok, "[;{}] %type%") && tok->next()->isUpperCaseName()) { const Token *tok2 = tok->tokAt(2); - if (tok2 && tok2->str() == "(") { - unsigned int par = 0; - for (; tok2; tok2 = tok2->next()) { - if (tok2->str() == "(") - ++par; - else if (tok2->str() == ")") { - if (par <= 1) - break; - --par; - } - } - if (tok2 && tok2->str() == ")") - tok2 = tok2->next(); - } + if (tok2 && tok2->str() == "(") + tok2 = tok2->link()->next(); // remove unknown macros before namespace|class|struct|union if (Token::Match(tok2, "namespace|class|struct|union")) {