< prev index next >
src/hotspot/share/utilities/ostream.cpp
Print this page
*** 366,377 ****
void stringStream::reset() {
buffer_pos = 0; _precount = 0; _position = 0;
zero_terminate();
}
! char* stringStream::as_string() const {
! char* copy = NEW_RESOURCE_ARRAY(char, buffer_pos + 1);
strncpy(copy, buffer, buffer_pos);
copy[buffer_pos] = 0; // terminating null
return copy;
}
--- 366,378 ----
void stringStream::reset() {
buffer_pos = 0; _precount = 0; _position = 0;
zero_terminate();
}
! char* stringStream::as_string(bool c_heap) const {
! char* copy = c_heap ?
! NEW_C_HEAP_ARRAY(char, buffer_pos + 1, mtInternal) : NEW_RESOURCE_ARRAY(char, buffer_pos + 1);
strncpy(copy, buffer, buffer_pos);
copy[buffer_pos] = 0; // terminating null
return copy;
}
< prev index next >