util: Remove [U](BEGIN|END) macros #15139

pull laanwj wants to merge 3 commits into bitcoin:master from laanwj:2018_01_utilstrencodings changing 6 files +10 −14
  1. laanwj commented at 1:01 AM on January 10, 2019: member

    Two cleanups in util/strencodings.h:

    • Remove [U](BEGIN|END) macros — The only use of these was in the Merkle tree code with uint256 which has its own begin and end methods which are better.
    • Make ToLower and ToUpper take a char — Unfortunately, std::string elements are (bare) chars. As these are the most likely type to be passed to these functions, make them use char instead of unsigned char. This avoids some casts.
  2. Replace use of BEGIN and END macros on uint256
    Replace use of `BEGIN` and `END` macros on uint256 with `begin()` and
    `end()` methods in the Merkle tree code.
    7fa238c701
  3. util: remove unused [U](BEGIN|END) macros edb5bb3500
  4. laanwj added the label Utils/log/libs on Jan 10, 2019
  5. util: Make ToLower and ToUpper take a char
    Unfortunately, `std::string` elements are (bare) chars. As these
    are the most likely type to be passed to these functions, make them use
    char instead of unsigned char. This avoids some casts.
    332b3dd7c1
  6. laanwj force-pushed on Jan 10, 2019
  7. Empact commented at 6:44 AM on January 10, 2019: member

    utACK 332b3dd - could squash the first two

  8. jonasschnelli commented at 6:51 AM on January 10, 2019: contributor

    utACK 332b3dd7c156daa08df347dc3359f0ee99ce4baa

  9. promag commented at 8:11 AM on January 10, 2019: member

    utACK 332b3dd.

  10. practicalswift commented at 8:25 AM on January 10, 2019: contributor

    utACK 332b3dd7c156daa08df347dc3359f0ee99ce4baa

    Would be nice to have #15134 merged for extra checking of these types of changes :-)

  11. sipa commented at 3:58 PM on January 10, 2019: member

    utACK

  12. MarcoFalke merged this on Jan 10, 2019
  13. MarcoFalke closed this on Jan 10, 2019

  14. MarcoFalke referenced this in commit 68dddccdaa on Jan 10, 2019
  15. in src/util/strencodings.cpp:592 in 332b3dd7c1
     588 | @@ -589,7 +589,7 @@ bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypa
     589 |  
     590 |  void Downcase(std::string& str)
     591 |  {
     592 | -    std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c){return ToLower(c);});
     593 | +    std::transform(str.begin(), str.end(), str.begin(), [](char c){return ToLower(c);});
    


    laanwj commented at 9:54 AM on January 11, 2019:

    Just realizing that it's passing a silly identity function:

    std::transform(str.begin(), str.end(), str.begin(), ToLower);
    

    Anyhow, not going to file a PR for just that, I guess the compiler optimizes this away, maybe someone touching this code in the future can take it into account.

  16. deadalnix referenced this in commit 0a1db10c79 on May 29, 2020
  17. deadalnix referenced this in commit bd6dd775d6 on May 29, 2020
  18. deadalnix referenced this in commit 47de8cc58f on Jun 2, 2020
  19. ftrader referenced this in commit 49e78f335e on Aug 17, 2020
  20. Munkybooty referenced this in commit 6ae365b5b3 on Aug 21, 2021
  21. Munkybooty referenced this in commit 5dba69c7f9 on Aug 23, 2021
  22. Munkybooty referenced this in commit e3e615506c on Aug 24, 2021
  23. Munkybooty referenced this in commit 9e5ed648c5 on Aug 24, 2021
  24. UdjinM6 referenced this in commit d098038e79 on Aug 24, 2021
  25. Munkybooty referenced this in commit b39ec37988 on Aug 24, 2021
  26. DrahtBot locked this on Dec 16, 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-04-13 15:15 UTC

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