< prev index next >

src/hotspot/share/utilities/ostream.cpp

Print this page

        

@@ -366,12 +366,13 @@
 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);
+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 >