--- a/hotspot/src/share/vm/utilities/debug.hpp Wed Jan 19 13:04:37 2011 -0800
+++ b/hotspot/src/share/vm/utilities/debug.hpp Wed Jan 19 19:30:42 2011 -0500
@@ -34,6 +34,7 @@
class FormatBuffer {
public:
inline FormatBuffer(const char * format, ...);
+ inline void append(const char* format, ...);
operator const char *() const { return _buf; }
private:
@@ -51,6 +52,19 @@
va_end(argp);
}
+template <size_t bufsz>
+void FormatBuffer<bufsz>::append(const char* format, ...) {
+ // Given that the constructor does a vsnprintf we can assume that
+ // _buf is already initialized.
+ size_t len = strlen(_buf);
+ char* buf_end = _buf + len;
+
+ va_list argp;
+ va_start(argp, format);
+ vsnprintf(buf_end, bufsz - len, format, argp);
+ va_end(argp);
+}
+
// Used to format messages for assert(), guarantee(), fatal(), etc.
typedef FormatBuffer<> err_msg;