diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-01-30 16:01:26 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-01-30 16:01:26 -0500 |
commit | 4ae64216c3c27e9f1e35ce93114f932f3d2c3361 (patch) | |
tree | fe3ca24667628af7c2e5a94a3bcae585fb492855 /base/cprintf.cc | |
parent | a0c3e61d320e72bbdddf4cea1413f6638e0faf45 (diff) | |
parent | 2f4f7aacf77dea16795a4052613da6092f6efc31 (diff) | |
download | gem5-4ae64216c3c27e9f1e35ce93114f932f3d2c3361.tar.xz |
Merge
--HG--
extra : convert_revision : 8690e31b64235874d74ea4a1123a408610fb115b
Diffstat (limited to 'base/cprintf.cc')
-rw-r--r-- | base/cprintf.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/base/cprintf.cc b/base/cprintf.cc index 5796a712b..5cbf0c057 100644 --- a/base/cprintf.cc +++ b/base/cprintf.cc @@ -37,9 +37,20 @@ using namespace std; namespace cp { +ArgList::~ArgList() +{ + while (!objects.empty()) { + delete objects.front(); + objects.pop_front(); + } +} + void ArgList::dump(const string &format) { + list_t::iterator iter = objects.begin(); + list_t::iterator end = objects.end(); + const char *p = format.c_str(); stream->fill(' '); @@ -198,22 +209,19 @@ ArgList::dump(const string &format) } } - if (!objects.empty()) + if (iter != end) { - Base *data = objects.front(); - objects.pop_front(); - ios::fmtflags saved_flags = stream->flags(); char old_fill = stream->fill(); int old_precision = stream->precision(); - data->process(*stream, fmt); + (*iter)->process(*stream, fmt); stream->flags(saved_flags); stream->fill(old_fill); stream->precision(old_precision); - delete data; + ++iter; } else { *stream << "<missing arg for format>"; } @@ -241,11 +249,9 @@ ArgList::dump(const string &format) } } - while (!objects.empty()) { + while (iter != end) { *stream << "<extra arg>"; - Base *data = objects.front(); - objects.pop_front(); - delete data; + ++iter; } } |