util: Make LineReader consistently use string_view #35828

pull hodlinator wants to merge 3 commits into bitcoin:master from hodlinator:2026/07/LineReader changing 7 files +33 −35
  1. hodlinator commented at 11:49 AM on July 28, 2026: contributor

    3 commits changing LineReader:

    • Avoid the duplicate check for \n happening inside RemoveSuffixView(). #35182 (review)
    • Use string_view internally rather than 2 span::iterators.
    • Stop accepting span<byte> inputs since internally and as outputs we treat them as strings.

    Found while reviewing #35182.

  2. util: LineReader - Don't include newline and acknowledge single-char \r
    Due to the preceeding if-condition we know \n is always there.
    e8eaa80ce2
  3. util: Make LineReader consistently use string_views
    Forcing the input through std::byte while always outputting strings was cumbersome.
    
    Also changes LineReader to a class and makes the fields private.
    5d5cdcd79d
  4. util: LineReader - Drop support for raw std::byte spans
    TorControlConnection and HTTPRemoteClient have been updated to use std::string receive buffers which mirrors approach in HTTPClient::ReadResponse().
    dff44e4c8f
  5. DrahtBot added the label Utils/log/libs on Jul 28, 2026
  6. DrahtBot commented at 11:49 AM on July 28, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35828.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK pinheadmz, furszy, achow101

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35829 (http: Make class fields private or convert to struct by hodlinator)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  7. pinheadmz approved
  8. pinheadmz commented at 7:24 PM on July 28, 2026: member

    ACK dff44e4c8f3070abe108965f216ec6b364ca882d

    Built and tested on macos/arm64. Reviewed all changes. This PR provides a no-op refactor to the string utility used by HTTP and torcontrol, reducing casts, cleaning up the interface and removing a redundant \n-check.

    <details><summary>Show Signature</summary>

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA256
    
    ACK dff44e4c8f3070abe108965f216ec6b364ca882d
    -----BEGIN PGP SIGNATURE-----
    
    iQJPBAEBCAA5FiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmppASsbFIAAAAAABAAO
    bWFudTIsMi41KzEuMTIsMCwzAAoJEOfimEtiick6gMQP/i1K/fjbHTsDjYN9eY5I
    60MheeLDviMi1dRqhc0ngQEaqmkDSGdgzCsD1001Da7h7as42Ih6vkmJMkJa48gI
    KA6eanJ0yr8Jdvt0vBm37bwbRmJIw7nB6TIIJm8lS0P5OymCkbN/D8MvkGUX9DGK
    klms3zQ+Gj41oUB/sOU3AWtNlpaRwl9yGi++22OPxL8ifS6zKBCydGDqlF8QrsMN
    hN85+9LACOMvPL12HzzaGx63ZcYqcul+Y6v9b/7FuWydiBbhqkiaa+enDFfElZEI
    T3Fypx3rThprZsqaJPnghRDLQiCM1Q+hiuvFoid3idwWDhS1jNP7hmD6YHhAEcCx
    lWc2b9q6aTwIcOZXlW6K1bWo5ql3khEBdFcKlsb6LheNgPk1gKnyonYVI4d3oNgA
    +a2djoZ55lrCZy/ayrEhtPWdhSnp45XKHhf5iA4d8Lypbx+LyKmQYhAzCrp5Aog6
    hmPFQ0KGlar2LTWLAHIJFaNnZL2olxHtIoeTQ/A0BfnuJBKctmbCuYis0alm4vep
    UHgS3TkKj/YcMlj7ZU0efsFljopKLcdTen5U+35bt8dixGKSWiidsf1TBe+2XAsH
    LEQ5QQO0t/bqVkc6CxnLapXKVOeQRihT2ssPEQRz0/1xiMIk3WOD1puPf3vo4g9R
    kVC3nooCbuXzTG8WqvHo1ksv
    =fN/T
    -----END PGP SIGNATURE-----
    

    pinheadmz's public key is on openpgp.org

    </details>

  9. furszy commented at 8:09 PM on July 29, 2026: member

    ACK dff44e4c8f3070abe108965f216ec6b364ca882d

  10. achow101 commented at 10:49 PM on July 29, 2026: member

    ACK dff44e4c8f3070abe108965f216ec6b364ca882d

  11. achow101 merged this on Jul 29, 2026
  12. achow101 closed this on Jul 29, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-07-30 06:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me