refactor: Remove unused raw-pointer read helper from univalue #28168

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2307-remove-code- changing 13 files +27 −26
  1. maflcko commented at 10:21 AM on July 27, 2023: member

    The helpers are unused outside of tests and redundant with the existing bool read(std::string_view raw);.

    Fix both issues by removing them.

    Also, simplify the tests code by removing a std::string constructor where possible.

  2. DrahtBot commented at 10:21 AM on July 27, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, TheCharlatan

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Refactoring on Jul 27, 2023
  4. fanquake requested review from stickies-v on Jul 27, 2023
  5. maflcko force-pushed on Jul 27, 2023
  6. in src/univalue/include/univalue.h:98 in fa783ac5c6 outdated
      93 | @@ -94,9 +94,7 @@ class UniValue {
      94 |      std::string write(unsigned int prettyIndent = 0,
      95 |                        unsigned int indentLevel = 0) const;
      96 |  
      97 | -    bool read(const char *raw, size_t len);
      98 | -    bool read(const char *raw) { return read(raw, strlen(raw)); }
    


    stickies-v commented at 10:47 AM on July 27, 2023:

    nit: can't get iwyu to work on this file, but i think #include <cstring> is now no longer required


    maflcko commented at 1:19 PM on July 27, 2023:

    can't get iwyu to work on this file

    You can just use the output produced by CI (tidy)

    but i think #include <cstring> is now no longer required

    Thanks, done.

  7. maflcko force-pushed on Jul 27, 2023
  8. DrahtBot added the label CI failed on Jul 27, 2023
  9. stickies-v approved
  10. stickies-v commented at 11:14 AM on July 27, 2023: contributor

    utACK 9999cfc1f3b728132e011f0aec24211212924de2

  11. maflcko force-pushed on Jul 27, 2023
  12. in build_msvc/test_bitcoin/test_bitcoin.vcxproj:71 in fa7668e7a7 outdated
      67 | @@ -68,7 +68,7 @@
      68 |        <RawTestFile Include="..\..\src\test\data\*.raw" />
      69 |      </ItemGroup>
      70 |      <HeaderFromHexdump RawFilePath="%(RawTestFile.FullPath)" HeaderFilePath="%(RawTestFile.FullPath).h" SourceHeader="static unsigned const char %(RawTestFile.Filename)_raw[] = {" SourceFooter="};" />
      71 | -    <HeaderFromHexdump RawFilePath="%(JsonTestFile.FullPath)" HeaderFilePath="%(JsonTestFile.FullPath).h" SourceHeader="namespace json_tests{ static unsigned const char %(JsonTestFile.Filename)[] = {" SourceFooter="};}" />
      72 | +    <HeaderFromHexdump RawFilePath="%(JsonTestFile.FullPath)" HeaderFilePath="%(JsonTestFile.FullPath).h" SourceHeader="#include <string> /*\n*/ namespace json_tests{ static const std::string %(JsonTestFile.Filename){" SourceFooter="};}" />
    


    maflcko commented at 11:57 AM on July 27, 2023:

    cc @sipsorcery @hebasto Any idea how to make a newline after the #include statement here on Windows?


    stickies-v commented at 12:18 PM on July 27, 2023:

    What about this? Adds a CR/LF so should work on windows? (but can't test)

    <HeaderFromHexdump RawFilePath="%(JsonTestFile.FullPath)" HeaderFilePath="%(JsonTestFile.FullPath).h" SourceHeader="#include &lt;string&gt;&#x0D;&#x0A;namespace json_tests{ static const std::string %(JsonTestFile.Filename){" SourceFooter="};}" />
    
    

    maflcko commented at 1:18 PM on July 27, 2023:

    Thanks, no idea if and why it worked, but the Windows CI passed the step.

  13. maflcko marked this as a draft on Jul 27, 2023
  14. Remove unused raw-pointer read helper from univalue fa940f41ea
  15. maflcko force-pushed on Jul 27, 2023
  16. maflcko marked this as ready for review on Jul 27, 2023
  17. stickies-v approved
  18. stickies-v commented at 1:19 PM on July 27, 2023: contributor

    utACK fa940f41eaffa4b2a28c465a10a4c12d4b8976b8

  19. DrahtBot removed the label CI failed on Jul 27, 2023
  20. TheCharlatan approved
  21. TheCharlatan commented at 10:11 AM on July 28, 2023: contributor

    tACK fa940f41eaffa4b2a28c465a10a4c12d4b8976b8

  22. fanquake merged this on Jul 28, 2023
  23. fanquake closed this on Jul 28, 2023

  24. maflcko deleted the branch on Jul 28, 2023
  25. sidhujag referenced this in commit 0b17a2d187 on Aug 9, 2023
  26. Fabcien referenced this in commit d3460c587e on Jun 6, 2024
  27. bitcoin locked this on Jul 27, 2024

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-04-22 06:13 UTC

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