8294293: Remove unused _width and _newlines field in outputStream
Reviewed-by: rehn, dholmes
This commit is contained in:
parent
c2ce43cbb0
commit
052a924985
@ -43,20 +43,16 @@
|
||||
extern "C" void jio_print(const char* s, size_t len);
|
||||
extern "C" int jio_printf(const char *fmt, ...);
|
||||
|
||||
outputStream::outputStream(int width) {
|
||||
_width = width;
|
||||
outputStream::outputStream() {
|
||||
_position = 0;
|
||||
_newlines = 0;
|
||||
_precount = 0;
|
||||
_indentation = 0;
|
||||
_scratch = NULL;
|
||||
_scratch_len = 0;
|
||||
}
|
||||
|
||||
outputStream::outputStream(int width, bool has_time_stamps) {
|
||||
_width = width;
|
||||
outputStream::outputStream(bool has_time_stamps) {
|
||||
_position = 0;
|
||||
_newlines = 0;
|
||||
_precount = 0;
|
||||
_indentation = 0;
|
||||
_scratch = NULL;
|
||||
@ -64,11 +60,12 @@ outputStream::outputStream(int width, bool has_time_stamps) {
|
||||
if (has_time_stamps) _stamp.update();
|
||||
}
|
||||
|
||||
void outputStream::update_position(const char* s, size_t len) {
|
||||
bool outputStream::update_position(const char* s, size_t len) {
|
||||
bool saw_newline = false;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
char ch = s[i];
|
||||
if (ch == '\n') {
|
||||
_newlines += 1;
|
||||
saw_newline = true;
|
||||
_precount += _position + 1;
|
||||
_position = 0;
|
||||
} else if (ch == '\t') {
|
||||
@ -79,6 +76,7 @@ void outputStream::update_position(const char* s, size_t len) {
|
||||
_position += 1;
|
||||
}
|
||||
}
|
||||
return saw_newline;
|
||||
}
|
||||
|
||||
// Execute a vsprintf, using the given buffer if necessary.
|
||||
@ -400,7 +398,6 @@ void stringStream::zero_terminate() {
|
||||
void stringStream::reset() {
|
||||
assert(_is_frozen == false, "Modification forbidden");
|
||||
_written = 0; _precount = 0; _position = 0;
|
||||
_newlines = 0;
|
||||
zero_terminate();
|
||||
}
|
||||
|
||||
@ -893,17 +890,17 @@ void defaultStream::write(const char* s, size_t len) {
|
||||
intx holder = hold(thread_id);
|
||||
|
||||
if (DisplayVMOutput &&
|
||||
(_outer_xmlStream == NULL || !_outer_xmlStream->inside_attrs())) {
|
||||
(_outer_xmlStream == nullptr || !_outer_xmlStream->inside_attrs())) {
|
||||
// print to output stream. It can be redirected by a vfprintf hook
|
||||
jio_print(s, len);
|
||||
}
|
||||
|
||||
// print to log file
|
||||
if (has_log_file()) {
|
||||
int nl0 = _newlines;
|
||||
xmlTextStream::write(s, len);
|
||||
if (has_log_file() && _outer_xmlStream != nullptr) {
|
||||
_outer_xmlStream->write_text(s, len);
|
||||
bool nl = update_position(s, len);
|
||||
// flush the log file too, if there were any newlines
|
||||
if (nl0 != _newlines){
|
||||
if (nl) {
|
||||
flush();
|
||||
}
|
||||
} else {
|
||||
|
@ -48,15 +48,14 @@ class outputStream : public ResourceObj {
|
||||
|
||||
protected:
|
||||
int _indentation; // current indentation
|
||||
int _width; // width of the page
|
||||
int _position; // position on the current line
|
||||
int _newlines; // number of '\n' output so far
|
||||
julong _precount; // number of chars output, less _position
|
||||
int _position; // visual position on the current line
|
||||
uint64_t _precount; // number of chars output, less than _position
|
||||
TimeStamp _stamp; // for time stamps
|
||||
char* _scratch; // internal scratch buffer for printf
|
||||
size_t _scratch_len; // size of internal scratch buffer
|
||||
|
||||
void update_position(const char* s, size_t len);
|
||||
// Returns whether a newline was seen or not
|
||||
bool update_position(const char* s, size_t len);
|
||||
static const char* do_vsnprintf(char* buffer, size_t buflen,
|
||||
const char* format, va_list ap,
|
||||
bool add_cr,
|
||||
@ -71,8 +70,8 @@ class outputStream : public ResourceObj {
|
||||
|
||||
public:
|
||||
// creation
|
||||
outputStream(int width = 80);
|
||||
outputStream(int width, bool has_time_stamps);
|
||||
outputStream();
|
||||
outputStream(bool has_time_stamps);
|
||||
|
||||
// indentation
|
||||
outputStream& indent();
|
||||
@ -86,7 +85,6 @@ class outputStream : public ResourceObj {
|
||||
void move_to(int col, int slop = 6, int min_space = 2);
|
||||
|
||||
// sizing
|
||||
int width() const { return _width; }
|
||||
int position() const { return _position; }
|
||||
julong count() const { return _precount + _position; }
|
||||
void set_count(julong count) { _precount = count - _position; }
|
||||
|
Loading…
Reference in New Issue
Block a user