RFR: 8293251: Use stringStream::base() instead of as_string() when applicable [v6]
Johan Sjölen
jsjolen at openjdk.org
Fri Sep 16 19:11:51 UTC 2022
On Wed, 14 Sep 2022 12:53:46 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Missed fixes
>
> Hi Johan,
>
> please be aware that changes like these across the code base makes downporting more painful. So I would only do wholesale renames and replacements where the benefit clearly outweighs the downporting costs.
>
> About your last iteration, yes, I think requiring base() to freeze the stream is a bit much.
>
> How about renaming "internal_string" to "freeze"
>
>
> // Freezes stringStream (no further modifications possible) and returns pointer to it.
> // No-op if stream is frozen already.
> const char* freeze();
>
>
> "freeze" is snappy and clear in its meaning. And in release builds I also would freeze, allowing no further changes, apart from the debug-only assert. Since writes potentially reallocate the buffer, the char ptr may be invalid, better to have incomplete stringStream output than C-heap corruption (as improbable as it is).
@tstuefe, @robehn
Alright tests are passing :). Would any of you mind sponsoring?
-------------
PR: https://git.openjdk.org/jdk/pull/10142
More information about the shenandoah-dev
mailing list