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: 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.. // Clear the error buffer..
errout.str(""); errout.str("");
@ -47,7 +47,7 @@ private:
// Tokenize.. // Tokenize..
Tokenizer tokenizer(&settings, this); Tokenizer tokenizer(&settings, this);
std::istringstream istr(code); std::istringstream istr(code);
tokenizer.tokenize(istr, filename.c_str()); tokenizer.tokenize(istr, filename);
// Assign variable ids // Assign variable ids
tokenizer.simplifyTokenList(); tokenizer.simplifyTokenList();

View File

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