fixed unlogged errors from the tokenizer and also some errors reported by valgrind

This commit is contained in:
Daniel Marjamäki 2010-01-10 20:03:46 +01:00
parent 1c69d54fb3
commit 3fb420cbf0
2 changed files with 6 additions and 6 deletions

View File

@ -1241,8 +1241,8 @@ void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all)
// Replace "{ }" with ";"
if (Token::simpleMatch(tok2->next(), "{ }"))
{
tok2->next()->str(";");
Token::eraseTokens(tok2->next(), tok2->tokAt(3));
tok2->eraseTokens(tok2, tok2->tokAt(3));
tok2->insertToken(";");
done = false;
}

View File

@ -592,10 +592,10 @@ private:
// switch..
ASSERT_EQUALS("; alloc ; dealloc ;", simplifycode(";alloc;switch{case;break;};dealloc;"));
ASSERT_EQUALS("; if return ; }", simplifycode("; switch { case ; return ; default ; break ; } }"));
ASSERT_EQUALS("; if return ; }", simplifycode("; switch { case ; if { return ; } break ; default ; break ; } }"));
ASSERT_EQUALS("; if return ; else use ; }", simplifycode("; switch { case ; return ; default ; use ; break ; } }"));
ASSERT_EQUALS("; use ; }", simplifycode("; while1 { loop { ; } switch { case ; dealloc ; return ; default ; break ; } } }"));
ASSERT_EQUALS("; if return ;", simplifycode("; switch { case ; return ; default ; break ; }"));
ASSERT_EQUALS("; if return ;", simplifycode("; switch { case ; if { return ; } break ; default ; break ; }"));
ASSERT_EQUALS("; if return ; else use ;", simplifycode("; switch { case ; return ; default ; use ; break ; }"));
ASSERT_EQUALS("; use ;", simplifycode("; while1 { loop { ; } switch { case ; dealloc ; return ; default ; break ; } }"));
// loops..
ASSERT_EQUALS(";", simplifycode("; loop { ; }"));