From ef09f3475c1246089eb1ef5bc67f3a020acf7bec Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Wed, 23 Sep 2009 00:23:11 +0300 Subject: [PATCH] Fix #713 (Tokenizer: Simplify 0L) http://sourceforge.net/apps/trac/cppcheck/ticket/713 --- src/tokenize.cpp | 3 ++- test/testtokenize.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index c4b1b5b81..470bf818a 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -1700,7 +1700,8 @@ void Tokenizer::simplifyTokenList() for (Token *tok = _tokens; tok; tok = tok->next()) { if (tok->str() == "NULL" || - tok->str() == "'\\0'") + tok->str() == "'\\0'" || + tok->str() == "0L") tok->str("0"); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 490acb39a..ea25058e8 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -381,6 +381,7 @@ private: " if (p1 != NULL || p2 == NULL) { ; }\n" " if (p1 != NULL && p2 == NULL) { ; }\n" " if (p == '\\0');\n" + " if (p == 0L);\n" "}\n"; ASSERT_EQUALS("void f ( )\n" @@ -412,6 +413,7 @@ private: "if ( p1 || ! p2 ) { ; }\n" "if ( p1 && ! p2 ) { ; }\n" "if ( ! p ) { ; }\n" + "if ( ! p ) { ; }\n" "}", tokenizeAndStringify(code, true)); }