RFR: 8298730: Refactor subsystem_file_line_contents and add docs and tests [v4]

Johan Sjölen jsjolen at openjdk.org
Tue Dec 27 12:42:51 UTC 2022


> Hi!
> 
> Citing the ticket directly:
> 
> The function subsystem_file_line_contents does the simple job of parsing lines in a file, but does so in a fairly complex way. This function can be simplified. The function also has a surprising API, as you need to know that in one case the format string needs to take 2 specifiers, instead of 1. 
> 
> Some more context:
> 
> `subsystem_file_line_contents` either parses files that look like this:
> 
> 
> one_value
> 
> 
> Called as: `subsystem_file_line_contents(ctrl, fname, nullptr, "%s")`
> 
> Or like this:
> 
> 
> key1 val1
> key2 val2
> 
> 
> Called as:  `subsystem_file_line_contents(ctrl, fname, "key1", "%s %s")`
> 
> The API for the key/value case is changed to: `subsystem_file_line_contents(ctrl, fname, "key1", "%s")`. Note: `"%s"`, not `"%s %s"`.

Johan Sjölen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 27 additional commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into refactor-container
 - Separate success and error cases
 - Add test
 - Inline literal string
 - Move test case to correct spot
 - Add two more test cases
 - Split into single-line and multiple-line tests
 - Rename tests
 - Revert
 - Specify buffer limit in format specifier
 - ... and 17 more: https://git.openjdk.org/jdk/compare/fa7185b4...5a17527d

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11667/files
  - new: https://git.openjdk.org/jdk/pull/11667/files/6488af3b..5a17527d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11667&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11667&range=02-03

  Stats: 26640 lines in 1111 files changed: 16751 ins; 5648 del; 4241 mod
  Patch: https://git.openjdk.org/jdk/pull/11667.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11667/head:pull/11667

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


More information about the hotspot-runtime-dev mailing list