Replace uses of boost::trim* with locale-independent alternatives#18130
Replace uses of boost::trim* with locale-independent alternatives#18130Empact wants to merge 3 commits intobitcoin:masterfrom
Conversation
|
Concept ACK Thanks a lot for getting rid of the use of locale dependent functions! That is appreciated. Please don't hesitate to take on some of the remaining |
7cf3e02 to
f4816da
Compare
|
ACK 7cf3e02096d7991fc144ef05f5f6b7fecd475b8c modulo that the existing |
f4816da to
392553f
Compare
|
Ok, took another look and it's straightforward to see that the value goes only to |
|
ACK fbc8195427cf98bf96eb76bafda39a4f38de3cd2 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
fbc8195 to
44f18a5
Compare
|
Small fixup - used clang-format-diff.py to identify a whitespace inconsistency in the last commit: diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index c3e08106e..15b8d3215 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(util_TrimString)
BOOST_CHECK_EQUAL(TrimString("\t \n foo \n\tbar\t \n ", "fobar"), "\t \n foo \n\tbar\t \n ");
BOOST_CHECK_EQUAL(TrimString("foo bar"), "foo bar");
BOOST_CHECK_EQUAL(TrimString("foo bar", "fobar"), " ");
- BOOST_CHECK_EQUAL(TrimString(std::string( "\0 foo \0 ", 8)), std::string("\0 foo \0", 7));
+ BOOST_CHECK_EQUAL(TrimString(std::string("\0 foo \0 ", 8)), std::string("\0 foo \0", 7));
BOOST_CHECK_EQUAL(TrimString(std::string(" foo ", 5)), std::string("foo", 3));
BOOST_CHECK_EQUAL(TrimString(std::string("\t\t\0\0\n\n", 6)), std::string("\0\0", 2));
BOOST_CHECK_EQUAL(TrimString(std::string("\x05\x04\x03\x02\x01\x00", 6)), std::string("\x05\x04\x03\x02\x01\x00", 6)); |
|
ACK 44f18a552e51cdb103845b592b87dbab571f8308 |
|
Anyone willing to review @Empact's excellent PR? Would be really nice to move forward with this one and plug another source of locale dependency. |
|
ACK 44f18a5 - nice! Next |
44f18a5 to
4c1abe6
Compare
|
re-ACK 4c1abe60467c1adfe0230f4bee56202150c0b134 |
Note the only use of readStdin is fed to DecodeHexTx, which fails in IsHex on non-hex characters as recorded in p_util_hexdigit.
4c1abe6 to
12c0546
Compare
|
re-ACK 12c0546 Nice to see the list of places where we rely on locale dependent functions shrink :) |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
@Empact Any chance you'd like to rebase this? Otherwise I can pick it up. |
|
I've rebased this in #22859. |
…ternatives (#18130 rebased) 696c76d tests: Add TrimString(...) tests (practicalswift) 4bf18b0 Replace use of boost::trim_right with locale-independent TrimString (Ben Woosley) 9355186 Replace use of boost::trim use with locale-independent TrimString (Ben Woosley) Pull request description: This is [#18130 rebased](#18130 (comment)). > `TrimString` is an existing alternative. > Note `TrimString` uses `" \f\n\r\t\v"` as the pattern, which is consistent with the default behavior of `std::isspace`. See: https://en.cppreference.com/w/cpp/string/byte/isspace ACKs for top commit: jb55: utACK 696c76d practicalswift: ACK 696c76d jonatack: ACK 696c76d theStack: Code-review ACK 696c76d Tree-SHA512: 6a70e3777602dfa65a60353e5c6874eb951e4a806844cd4bdaa4237cad980a4f61ec205defc05a29f9707776835975838f6cc635259c42adfe37ceb02ba9358d
TrimStringis an existing alternative.I patternedTrimRightafter it.Note
TrimStringandusesTrimRight" \f\n\r\t\v"as the pattern, which is consistent with the default behavior ofstd::isspace.https://en.cppreference.com/w/cpp/string/byte/isspace