RFR: 8294293: Remove unused _width and _newlines field in outputStream

Johan Sjölen jsjolen at openjdk.org
Fri Sep 23 16:20:16 UTC 2022


1. `_width` is unused so I deleted it
2. `_newlines` was used in one place, and only to check if any new lines had been seen. I removed `_newlines` and instead used `update_position`'s unused return value to indicate whether any newlines has been seen. This required expanding the call of `xmlTextStream::write` in `defaultStream`.

This removes some cruft from `outputStream` and saves us 8 bytes on the size of `outputStream`.

I also noted that `_position` isn't number of chars into a line, but rather a "visual position". It's a bit surprising, which is why I added this comment. This can be seen in the `\t` case in `update_position`.

-------------

Commit messages:
 - Reduce size and API scope of outputStream

Changes: https://git.openjdk.org/jdk/pull/10411/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10411&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294293
  Stats: 26 lines in 2 files changed: 4 ins; 8 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/10411.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10411/head:pull/10411

PR: https://git.openjdk.org/jdk/pull/10411


More information about the hotspot-dev mailing list