Get rid of the gross operator,()/variadic macro hack
that made ccprintf and friends work, turn it into a
normal function (though it still has a slightly strange
implementation.) All instances of variadic macros
are not yet removed, but I know how, and it will happen.
One side effect of this new implementation is that a
cprintf statement can now only have 16 parameters, though
it's easy enough to raise this number if needed.
--HG--
extra : convert_revision : 85cb3c17f8e2ecf9cd2f31ea80a760a28ea127a7
diff --git a/src/base/trace.cc b/src/base/trace.cc
index 9fa615f..6e98384 100644
--- a/src/base/trace.cc
+++ b/src/base/trace.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2005 The Regents of The University of Michigan
+ * Copyright (c) 2001-2006 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,7 @@
#include "base/misc.hh"
#include "base/trace.hh"
#include "base/str.hh"
+#include "base/varargs.hh"
using namespace std;
@@ -153,9 +154,7 @@
}
PrintfRecord::~PrintfRecord()
-{
- delete &args;
-}
+{}
void
PrintfRecord::dump(ostream &os)
@@ -164,17 +163,17 @@
if (!name.empty()) {
fmt = "%s: " + fmt;
- args.prepend(name);
+ args.push_front(name);
}
if (cycle != (Tick)-1) {
fmt = "%7d: " + fmt;
- args.prepend(cycle);
+ args.push_front(cycle);
}
fmt += format;
- args.dump(os, fmt);
+ ccprintf(os, fmt.c_str(), args);
os.flush();
}