mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-26 02:00:12 +00:00
8310170: Use sp's argument to improve performance of outputStream::indent and remove SP_USE_TABS
Reviewed-by: shade, dholmes, stuefe
This commit is contained in:
parent
25cbe85d6f
commit
92ca670bf3
@ -186,18 +186,9 @@ void outputStream::put(char ch) {
|
||||
write(buf, 1);
|
||||
}
|
||||
|
||||
#define SP_USE_TABS false
|
||||
|
||||
void outputStream::sp(int count) {
|
||||
if (count < 0) return;
|
||||
if (SP_USE_TABS && count >= 8) {
|
||||
int target = position() + count;
|
||||
while (count >= 8) {
|
||||
this->write("\t", 1);
|
||||
count -= 8;
|
||||
}
|
||||
count = target - position();
|
||||
}
|
||||
|
||||
while (count > 0) {
|
||||
int nw = (count > 8) ? 8 : count;
|
||||
this->write(" ", nw);
|
||||
@ -257,7 +248,7 @@ void outputStream::date_stamp(bool guard,
|
||||
}
|
||||
|
||||
outputStream& outputStream::indent() {
|
||||
while (_position < _indentation) sp();
|
||||
sp(_indentation - _position);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user