Move util files to directory #14555

pull jimpo wants to merge 1 commits into bitcoin:master from jimpo:util-cleanup changing 152 files +239 −239
  1. jimpo commented at 5:13 PM on October 23, 2018: contributor

    As discussed here, this establishes a util/ directory to introduce more organizational structure and have a clear place for new util files. It's really not scary to review, it's just one big scripted diff.

  2. MarcoFalke commented at 6:11 PM on October 23, 2018: member

    The scripted diff will also run on non-git files that happen to be in the folder. Imo, this should be avoided by using a git ls-files with a filter or something.

  3. DrahtBot commented at 9:58 PM on October 23, 2018: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->Reviewers, this pull request conflicts with the following ones:

    • #14585 (refactor: remove usage of locale dependent std::isspace by practicalswift)
    • #14530 (Use RPCHelpMan to generate RPC doc strings by MarcoFalke)
    • #14521 (qt, docs: Fix bitcoin-qt -version output formatting by hebasto)
    • #14384 (Resolve validationinterface circular dependencies by 251Labs)
    • #14224 (Document intentional and unintentional unsigned integer overflows (wraparounds) using annotations by practicalswift)
    • #14047 (Add HKDF_HMAC256_L32 and method to negate a private key by jonasschnelli)
    • #14045 (refactor: Fix the chainparamsbase -> util circular dependency by Empact)
    • #14035 (Utxoscriptindex by mgrychow)
    • #13815 (util: Add [[nodiscard]] to all {Decode,Parse}... functions returning bool by practicalswift)
    • #13751 (Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by 251Labs)
    • #13746 (-masterdatadir for datadir bootstrapping by kallewoof)
    • #12677 (RPC: Add ancestor{count,size,fees} to listunspent output by luke-jr)
    • #11785 (Raise the open fd limit to the maximum allowed by vii)
    • #10443 (Add fee_est tool for debugging fee estimation code by ryanofsky)

    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.

  4. DrahtBot cross-referenced this on Oct 23, 2018 from issue Use RPCHelpMan to generate RPC doc strings by MarcoFalke
  5. DrahtBot cross-referenced this on Oct 23, 2018 from issue qt, docs: Fix `bitcoin-qt -version` output formatting by hebasto
  6. fanquake added the label Utils/log/libs on Oct 23, 2018
  7. DrahtBot cross-referenced this on Oct 23, 2018 from issue Rpc help helper class by karelbilek
  8. DrahtBot cross-referenced this on Oct 23, 2018 from issue Fire TransactionRemovedFromMempool callbacks from mempool by l2a5b1
  9. DrahtBot cross-referenced this on Oct 23, 2018 from issue Document intentional and unintentional unsigned integer overflows (wraparounds) using annotations by practicalswift
  10. DrahtBot cross-referenced this on Oct 23, 2018 from issue Add HKDF_HMAC256_L32 and method to negate a private key by jonasschnelli
  11. DrahtBot cross-referenced this on Oct 23, 2018 from issue refactor: Fix the chainparamsbase -> util circular dependency by Empact
  12. DrahtBot cross-referenced this on Oct 23, 2018 from issue Utxoscriptindex by mgrychow
  13. DrahtBot cross-referenced this on Oct 23, 2018 from issue util: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool by practicalswift
  14. DrahtBot cross-referenced this on Oct 23, 2018 from issue Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by l2a5b1
  15. DrahtBot cross-referenced this on Oct 23, 2018 from issue -masterdatadir for datadir bootstrapping by kallewoof
  16. DrahtBot cross-referenced this on Oct 24, 2018 from issue RPC: Add ancestor{count,size,fees} to listunspent output by luke-jr
  17. DrahtBot cross-referenced this on Oct 24, 2018 from issue Add fee_est tool for debugging fee estimation code by ryanofsky
  18. promag commented at 8:54 AM on October 24, 2018: member

    IMO scripted diff commit could have the mv commands to avoid having a bad commit.

  19. jimpo force-pushed on Oct 25, 2018
  20. jimpo force-pushed on Oct 25, 2018
  21. jimpo force-pushed on Oct 25, 2018
  22. jimpo force-pushed on Oct 25, 2018
  23. ken2812221 commented at 4:00 AM on October 25, 2018: contributor

    Could you please apply this as the second commit? Thanks

    diff --git a/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj b/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
    index 0be7e7e43..2c6c0a8b7 100644
    --- a/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
    +++ b/build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
    @@ -40,7 +40,7 @@
         <ClCompile Include="..\..\src\script\script.cpp" />
         <ClCompile Include="..\..\src\script\script_error.cpp" />
         <ClCompile Include="..\..\src\uint256.cpp" />
    -    <ClCompile Include="..\..\src\utilstrencodings.cpp" />
    +    <ClCompile Include="..\..\src\util\strencodings.cpp" />
       </ItemGroup>
       <ItemGroup>
         <None Include="packages.config" />
    
  24. jimpo force-pushed on Oct 26, 2018
  25. ken2812221 commented at 9:19 AM on October 26, 2018: contributor

    utACK d0f883e9c5c7dd1ac9efcd69eb0065e47376afef

  26. promag commented at 9:25 AM on October 26, 2018: member

    utACK d0f883e, sorry conflicts..

  27. MarcoFalke commented at 11:40 AM on October 26, 2018: member

    utACK d0f883e9c5c7dd1ac9efcd69eb0065e47376afef

  28. scravy commented at 11:43 AM on October 26, 2018: contributor

    utACK d0f883e

  29. DrahtBot cross-referenced this on Oct 26, 2018 from issue refactor: remove usage of locale dependent std::isspace by practicalswift
  30. DrahtBot added the label Needs rebase on Oct 28, 2018
  31. meshcollider commented at 5:15 AM on November 3, 2018: contributor
  32. jimpo force-pushed on Nov 4, 2018
  33. DrahtBot removed the label Needs rebase on Nov 4, 2018
  34. promag commented at 6:17 PM on November 4, 2018: member

    After rebase:

    diff --git a/src/base58.cpp b/src/base58.cpp
    index eac763394..e3d285339 100644
    --- a/src/base58.cpp
    +++ b/src/base58.cpp
    @@ -6,7 +6,7 @@
     
     #include <hash.h>
     #include <uint256.h>
    -#include <utilstrencodings.h>
    +#include <util/strencodings.h>
     
     #include <assert.h>
     #include <string.h>
    
  35. scripted-diff: Move util files to separate directory.
    -BEGIN VERIFY SCRIPT-
    mkdir -p src/util
    git mv src/util.h src/util/system.h
    git mv src/util.cpp src/util/system.cpp
    git mv src/utilmemory.h src/util/memory.h
    git mv src/utilmoneystr.h src/util/moneystr.h
    git mv src/utilmoneystr.cpp src/util/moneystr.cpp
    git mv src/utilstrencodings.h src/util/strencodings.h
    git mv src/utilstrencodings.cpp src/util/strencodings.cpp
    git mv src/utiltime.h src/util/time.h
    git mv src/utiltime.cpp src/util/time.cpp
    
    sed -i 's/<util\.h>/<util\/system\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
    sed -i 's/<utilmemory\.h>/<util\/memory\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
    sed -i 's/<utilmoneystr\.h>/<util\/moneystr\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
    sed -i 's/<utilstrencodings\.h>/<util\/strencodings\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
    sed -i 's/<utiltime\.h>/<util\/time\.h>/g' $(git ls-files 'src/*.h' 'src/*.cpp')
    
    sed -i 's/BITCOIN_UTIL_H/BITCOIN_UTIL_SYSTEM_H/g' src/util/system.h
    sed -i 's/BITCOIN_UTILMEMORY_H/BITCOIN_UTIL_MEMORY_H/g' src/util/memory.h
    sed -i 's/BITCOIN_UTILMONEYSTR_H/BITCOIN_UTIL_MONEYSTR_H/g' src/util/moneystr.h
    sed -i 's/BITCOIN_UTILSTRENCODINGS_H/BITCOIN_UTIL_STRENCODINGS_H/g' src/util/strencodings.h
    sed -i 's/BITCOIN_UTILTIME_H/BITCOIN_UTIL_TIME_H/g' src/util/time.h
    
    sed -i 's/ util\.\(h\|cpp\)/ util\/system\.\1/g' src/Makefile.am
    sed -i 's/utilmemory\.\(h\|cpp\)/util\/memory\.\1/g' src/Makefile.am
    sed -i 's/utilmoneystr\.\(h\|cpp\)/util\/moneystr\.\1/g' src/Makefile.am
    sed -i 's/utilstrencodings\.\(h\|cpp\)/util\/strencodings\.\1/g' src/Makefile.am
    sed -i 's/utiltime\.\(h\|cpp\)/util\/time\.\1/g' src/Makefile.am
    
    sed -i 's/-> util ->/-> util\/system ->/' test/lint/lint-circular-dependencies.sh
    sed -i 's/src\/util\.cpp/src\/util\/system\.cpp/g' test/lint/lint-format-strings.py test/lint/lint-locale-dependence.sh
    sed -i 's/src\/utilmoneystr\.cpp/src\/util\/moneystr\.cpp/g' test/lint/lint-locale-dependence.sh
    sed -i 's/src\/utilstrencodings\.\(h\|cpp\)/src\/util\/strencodings\.\1/g' test/lint/lint-locale-dependence.sh
    sed -i 's/src\\utilstrencodings\.cpp/src\\util\\strencodings\.cpp/' build_msvc/libbitcoinconsensus/libbitcoinconsensus.vcxproj
    -END VERIFY SCRIPT-
    2068f089c8
  36. jimpo force-pushed on Nov 5, 2018
  37. ken2812221 commented at 7:13 AM on November 5, 2018: contributor

    utACK 2068f089c8b7b90eb4557d3f67ea0f0ed2059a23

  38. fanquake commented at 8:52 AM on November 5, 2018: member

    tACK 2068f08 make check and ran the functional tests.

    Might be a good to merge this now, to save the constant rebasing. Doesn't look like this will break any ready to merge/PRs with ACKs etc.

  39. promag commented at 9:02 AM on November 5, 2018: member

    Agree with @fanquake, ACK 2068f08.

  40. laanwj commented at 10:34 AM on November 5, 2018: member

    utACK 2068f089c8b7b90eb4557d3f67ea0f0ed2059a23

    • util/system.h is great naming, yes, the file is for os/system utilities
    • We need to come up with guidelines (in the developer notes) what to put in src/compat versus src/support versus src/util, all three are more or less utilities. But that can be done later.
  41. laanwj merged this on Nov 5, 2018
  42. laanwj closed this on Nov 5, 2018

  43. laanwj referenced this in commit bccb4d29a8 on Nov 5, 2018
  44. laanwj cross-referenced this on Nov 6, 2018 from issue Return of the Banman by dongcarl
  45. ryanofsky cross-referenced this on Nov 6, 2018 from issue Refactor: separate wallet from node by ryanofsky
  46. kwvg referenced this in commit 570a8885fc on Jun 15, 2021
  47. kwvg cross-referenced this on Jun 15, 2021 from issue partial bitcoin#15638, #21966, #16889, merge #14555, #20499, #14074, #17073: util refactoring by kwvg
  48. kwvg referenced this in commit 110e20731f on Jun 15, 2021
  49. kwvg referenced this in commit 1f328c1c8e on Jun 16, 2021
  50. kwvg referenced this in commit 2350001a63 on Jun 25, 2021
  51. kwvg referenced this in commit a4745a6aec on Jun 25, 2021
  52. kwvg referenced this in commit 1c91ce508f on Jun 27, 2021
  53. kwvg referenced this in commit ef4dfa8524 on Jun 27, 2021
  54. UdjinM6 referenced this in commit 7d664c7c53 on Jun 27, 2021
  55. bitcoin locked this on Sep 8, 2021

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-05-20 06:54 UTC