RFR: 8308252: Refactor line-by-line file reading code [v6]

Calvin Cheung ccheung at openjdk.org
Thu May 25 17:04:06 UTC 2023


On Wed, 24 May 2023 23:41:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> I extracted the `get_line()` code from `CompileReplay` and put it in a utility class so that it can be used by `ClassListParser` as well. A few notable changes:
>> 
>> - Simplified the API
>> - Changed the buffer size to a size_t
>> - Added size overflow and OOM checks
>> - Brought over the `fdopen` logic from `ClassListParser` for handling long path names on Windows. (I don't know how valid this is nowadays, but I don't want to drop it in a refactoring PR).
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   try to fix windows build

Just one minor comment on the latest change.

src/hotspot/share/utilities/lineReader.cpp line 102:

> 100:   if (buffer_pos == 0 && c == EOF) {
> 101:     int n = errno;
> 102:     _last_errno = n;

Is it possible to assign `errno` directly to `_last_errno`?

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

Marked as reviewed by ccheung (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14025#pullrequestreview-1444322400
PR Review Comment: https://git.openjdk.org/jdk/pull/14025#discussion_r1205797015


More information about the hotspot-dev mailing list