< prev index next >
src/share/vm/oops/symbol.cpp
Print this page
rev 10169 : 8149557: Resource mark breaks printing to string stream
*** 156,168 ****
void Symbol::print_utf8_on(outputStream* st) const {
st->print("%s", as_C_string());
}
void Symbol::print_symbol_on(outputStream* st) const {
! ResourceMark rm;
st = st ? st : tty;
! st->print("%s", as_quoted_ascii());
}
char* Symbol::as_quoted_ascii() const {
const char *ptr = (const char *)&_body[0];
int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length());
--- 156,176 ----
void Symbol::print_utf8_on(outputStream* st) const {
st->print("%s", as_C_string());
}
void Symbol::print_symbol_on(outputStream* st) const {
! char *s;
st = st ? st : tty;
! {
! // ResourceMark may not affect st->print(). If st is a string
! // stream it could resize, using the same resource arena.
! ResourceMark rm;
! s = as_quoted_ascii();
! s = os::strdup(s);
! }
! st->print("%s", s);
! os::free(s);
}
char* Symbol::as_quoted_ascii() const {
const char *ptr = (const char *)&_body[0];
int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length());
< prev index next >