< prev index next >
src/share/vm/utilities/debug.hpp
Print this page
@@ -34,25 +34,25 @@
class FormatBufferBase {
protected:
char* _buf;
inline FormatBufferBase(char* buf) : _buf(buf) {}
public:
+ static const int BufferSize = 256;
operator const char *() const { return _buf; }
};
// Use resource area for buffer
-#define BUFSZ 256
class FormatBufferResource : public FormatBufferBase {
public:
FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
};
// Use stack for buffer
-template <size_t bufsz = BUFSZ>
+template <size_t bufsz = FormatBufferBase::BufferSize>
class FormatBuffer : public FormatBufferBase {
public:
- inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
+ inline FormatBuffer(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
char* buffer() { return _buf; }
@@ -103,11 +103,11 @@
va_start(argp, format);
jio_vsnprintf(buf_end, bufsz - len, format, argp);
va_end(argp);
}
-// Used to format messages
+// Used to format messages.
typedef FormatBuffer<> err_msg;
// assertions
#ifndef ASSERT
#define vmassert(p, ...)
< prev index next >