comparison src/share/vm/utilities/debug.hpp @ 2491:0654ee04b214

Merge with OpenJDK.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 22 Apr 2011 15:30:53 +0200
parents 1d1603768966
children aa3d708d67c4
comparison
equal deleted inserted replaced
2490:29246b1d2d3c 2491:0654ee04b214
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
23 */ 23 */
24 24
25 #ifndef SHARE_VM_UTILITIES_DEBUG_HPP 25 #ifndef SHARE_VM_UTILITIES_DEBUG_HPP
26 #define SHARE_VM_UTILITIES_DEBUG_HPP 26 #define SHARE_VM_UTILITIES_DEBUG_HPP
27 27
28 #include "prims/jvm.h"
28 #include "utilities/globalDefinitions.hpp" 29 #include "utilities/globalDefinitions.hpp"
29 30
30 #include <stdarg.h> 31 #include <stdarg.h>
31 32
32 // Simple class to format the ctor arguments into a fixed-sized buffer. 33 // Simple class to format the ctor arguments into a fixed-sized buffer.
46 47
47 template <size_t bufsz> 48 template <size_t bufsz>
48 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) { 49 FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) {
49 va_list argp; 50 va_list argp;
50 va_start(argp, format); 51 va_start(argp, format);
51 vsnprintf(_buf, bufsz, format, argp); 52 jio_vsnprintf(_buf, bufsz, format, argp);
52 va_end(argp); 53 va_end(argp);
53 } 54 }
54 55
55 template <size_t bufsz> 56 template <size_t bufsz>
56 void FormatBuffer<bufsz>::append(const char* format, ...) { 57 void FormatBuffer<bufsz>::append(const char* format, ...) {
59 size_t len = strlen(_buf); 60 size_t len = strlen(_buf);
60 char* buf_end = _buf + len; 61 char* buf_end = _buf + len;
61 62
62 va_list argp; 63 va_list argp;
63 va_start(argp, format); 64 va_start(argp, format);
64 vsnprintf(buf_end, bufsz - len, format, argp); 65 jio_vsnprintf(buf_end, bufsz - len, format, argp);
65 va_end(argp); 66 va_end(argp);
66 } 67 }
67 68
68 // Used to format messages for assert(), guarantee(), fatal(), etc. 69 // Used to format messages for assert(), guarantee(), fatal(), etc.
69 typedef FormatBuffer<> err_msg; 70 typedef FormatBuffer<> err_msg;