Refactorizations in test suite:

- Removed again one custom stringify implementation
- Avoided unnecessary std::string creation in testbufferoverrun.cpp
This commit is contained in:
PKEuS 2012-04-16 20:02:52 +02:00
parent bac8ed7127
commit 4dcb2ef57b
2 changed files with 3 additions and 7 deletions

View File

@ -33,7 +33,7 @@ public:
private:
void check(const char code[], bool experimental = true, const std::string &filename="test.cpp") {
void check(const char code[], bool experimental = true, const char filename[] = "test.cpp") {
// Clear the error buffer..
errout.str("");
@ -47,7 +47,7 @@ private:
// Tokenize..
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, filename.c_str());
tokenizer.tokenize(istr, filename);
// Assign variable ids
tokenizer.simplifyTokenList();

View File

@ -635,11 +635,7 @@ private:
CheckMemoryLeakInFunction checkMemoryLeak(&tokenizer, &settings, NULL);
checkMemoryLeak.simplifycode(tokens);
std::ostringstream ret;
for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next())
ret << (tok->previous() ? " " : "") << tok->str();
return ret.str();
return tokenizer.tokens()->stringifyList(0, false);
}