Refactoring: Use the MathLib::toString() to stringify a number.

No functional change.
This commit is contained in:
Slava Semushin 2009-08-22 18:44:12 +07:00
parent 724d6bf53a
commit 6a5afd6243
1 changed files with 4 additions and 12 deletions

View File

@ -1361,9 +1361,7 @@ void Tokenizer::simplifyTokenList()
if (Token::Match(tok, "sizeof ( * )")) if (Token::Match(tok, "sizeof ( * )"))
{ {
std::ostringstream str; tok->str(MathLib::toString<long>(sizeOfType(tok->strAt(2))));
str << sizeOfType(tok->strAt(2));
tok->str(str.str());
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
@ -1383,9 +1381,7 @@ void Tokenizer::simplifyTokenList()
int size = sizeOfType(type); int size = sizeOfType(type);
if (size > 0) if (size > 0)
{ {
std::ostringstream str; tok->str(MathLib::toString<long>(size));
str << size;
tok->str(str.str());
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
tok->deleteNext(); tok->deleteNext();
@ -1411,9 +1407,7 @@ void Tokenizer::simplifyTokenList()
if (sz > 0) if (sz > 0)
{ {
std::ostringstream ostr; tok->str(MathLib::toString<long>(sz));
ostr << sz;
tok->str(ostr.str());
while (tok->next()->str() != ")") while (tok->next()->str() != ")")
tok->deleteNext(); tok->deleteNext();
tok->deleteNext(); tok->deleteNext();
@ -1460,9 +1454,7 @@ void Tokenizer::simplifyTokenList()
else if (Token::Match(tok2, "sizeof ( %varid% )", varid)) else if (Token::Match(tok2, "sizeof ( %varid% )", varid))
{ {
std::ostringstream str; tok2->str(MathLib::toString<long>(total_size));
str << total_size;
tok2->str(str.str());
// Delete the other tokens.. // Delete the other tokens..
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {