Remove boost::program_options dependency #13482
pull ken2812221 wants to merge 2 commits into bitcoin:master from ken2812221:program_options changing 7 files +42 −123-
ken2812221 commented at 4:25 am on June 16, 2018: contributorConcept from #12744, but without parsing negated options.
-
fanquake added the label Refactoring on Jun 16, 2018
-
ken2812221 force-pushed on Jun 16, 2018
-
in src/util.h:290 in 9b0d45aa74 outdated
281@@ -282,6 +282,17 @@ class ArgsManager 282 * Check whether we know of this arg 283 */ 284 bool IsArgKnown(const std::string& key, std::string& error); 285+ 286+private: 287+ /** 288+ * Trim string by the pattern 289+ */ 290+ std::string trimString(std::string str, const std::string& pattern);
qmma70 commented at 6:16 pm on June 16, 2018:Is there a reason for this method to start with a lower case letter while all other start with upper case letters?
ken2812221 commented at 8:50 pm on June 16, 2018:No reason. So make it uppercase.in src/util.cpp:822 in 9b0d45aa74 outdated
821- { 822- std::string strKey = std::string("-") + it->string_key; 823- std::string strValue = it->value[0]; 824+ auto options = GetConfigOptions(stream); 825+ 826+ for (auto it = options.begin(), end = options.end(); it != end; ++it) {
qmma70 commented at 6:19 pm on June 16, 2018:Usecbegin()
andcend()
please.
ken2812221 commented at 8:52 pm on June 16, 2018:I made it range-basedin src/util.cpp:954 in 9b0d45aa74 outdated
949+ if (*str.begin() == '[' && *str.rbegin() == ']') 950+ prefix = str.substr(1, str.size() - 2) + '.'; 951+ else if ((pos = str.find('=')) != std::string::npos) { 952+ std::string name = prefix + trimString(str.substr(0, pos), " \t\r\n"); 953+ std::string value = trimString(str.substr(pos + 1), " \t\r\n"); 954+ options.push_back(std::pair<std::string, std::string>(name, value));
qmma70 commented at 6:21 pm on June 16, 2018:Minor: can usestd::make_pair(name, value)
for simplicity.
ken2812221 commented at 8:54 pm on June 16, 2018:emplace_back
is more simple.ken2812221 force-pushed on Jun 16, 2018ken2812221 force-pushed on Jun 16, 2018qmma70 commented at 9:07 pm on June 16, 2018: contributorI’m utAck on this. Nicely done.
This could have also been implemented with regex, but the pattern is simple enough that the logic is easily understandable.
ken2812221 commented at 1:19 am on June 18, 2018: contributorken2812221 commented at 6:05 pm on June 18, 2018: contributorCurrent on master, if there are some options in the config file without=
, they would cause an exception. In this PR, I simply ignore them, or should I also throw an exception?fanquake added this to the "In progress" column in a project
jezzalladmins changes_requestedjezzalladmins commented at 8:04 am on June 22, 2018: noneRunDrahtBot added the label Needs rebase on Jun 24, 2018DrahtBot commented at 2:18 pm on June 24, 2018: memberMarcoFalke commented at 2:21 pm on June 24, 2018: memberUpdatedoc/build-unix.md
as well?ken2812221 force-pushed on Jun 25, 2018ken2812221 force-pushed on Jun 25, 2018ken2812221 commented at 2:52 am on June 25, 2018: contributor@MarcoFalke SureDrahtBot removed the label Needs rebase on Jun 25, 2018in src/util.cpp:940 in 092864dfc7 outdated
935+{ 936+ std::vector<std::pair<std::string, std::string>> options; 937+ std::string str, prefix; 938+ std::string::size_type pos; 939+ while (std::getline(stream, str)) { 940+ if ((pos = str.find('#')) != std::string::npos)
sipa commented at 0:25 am on June 27, 2018:Coding style nit: use braces whenever indenting.
ken2812221 commented at 2:07 am on June 29, 2018:Fixedin src/util.cpp:949 in 092864dfc7 outdated
941+ str = str.substr(0, pos); 942+ str = TrimString(str, " \t\r\n"); 943+ if (!str.empty()) { 944+ if (*str.begin() == '[' && *str.rbegin() == ']') 945+ prefix = str.substr(1, str.size() - 2) + '.'; 946+ else if ((pos = str.find('=')) != std::string::npos) {
sipa commented at 0:25 am on June 27, 2018:Same here.
ken2812221 commented at 2:07 am on June 29, 2018:Fixedin src/util.cpp:942 in 092864dfc7 outdated
937+ std::string str, prefix; 938+ std::string::size_type pos; 939+ while (std::getline(stream, str)) { 940+ if ((pos = str.find('#')) != std::string::npos) 941+ str = str.substr(0, pos); 942+ str = TrimString(str, " \t\r\n");
sipa commented at 0:27 am on June 27, 2018:Maybe introduce a static constant for this set of trimmable characters?
ken2812221 commented at 2:07 am on June 29, 2018:I’m not sure this is what you want.ken2812221 force-pushed on Jun 27, 2018ken2812221 force-pushed on Jun 27, 2018ken2812221 force-pushed on Jun 29, 2018ken2812221 force-pushed on Jun 29, 2018in src/util.cpp:925 in 5d7d1a2db8 outdated
921@@ -927,6 +922,40 @@ std::string ArgsManager::GetChainName() const 922 return CBaseChainParams::MAIN; 923 } 924 925+std::string ArgsManager::TrimString(const std::string& str, const std::string& pattern)
sipa commented at 2:02 am on July 18, 2018:This can just be a static function; it doesn’t need to be a method ofArgsManager
.ken2812221 force-pushed on Jul 18, 2018ken2812221 closed this on Jul 18, 2018
Replace boost program_options 11588c639eRemove program options from build system f447a0a707sipa commented at 2:50 am on July 18, 2018: memberWhy close?ken2812221 commented at 2:51 am on July 18, 2018: contributorSorry, misclickedken2812221 reopened this on Jul 18, 2018
ken2812221 force-pushed on Jul 18, 2018fanquake added this to the milestone 0.17.0 on Jul 18, 2018sipa commented at 9:50 pm on July 19, 2018: memberutACK f447a0a7079619f0d650084df192781cca9fd826in build-aux/m4/ax_boost_program_options.m4:1 in f447a0a707
-1@@ -1,108 +0,0 @@ 0-# ============================================================================
laanwj commented at 2:30 pm on July 20, 2018:I like this file-bloodbath.laanwj commented at 2:40 pm on July 20, 2018: member+42 −123 even though this is removing an external dependency, if that isn’t a clear indication that this should be done I don’t know what is. utACK f447a0a7079619f0d650084df192781cca9fd826laanwj merged this on Jul 20, 2018laanwj closed this on Jul 20, 2018
laanwj referenced this in commit 2dc5ab6378 on Jul 20, 2018ken2812221 deleted the branch on Jul 20, 2018fanquake moved this from the "In progress" to the "Done" column in a project
laanwj referenced this in commit 90c0b6aca2 on Nov 12, 2018furszy referenced this in commit 4bf92204e4 on Apr 30, 2021UdjinM6 referenced this in commit 0c5896078f on Jun 29, 2021UdjinM6 referenced this in commit db8ed9f495 on Jun 29, 2021UdjinM6 referenced this in commit 63443e26fd on Jul 1, 2021UdjinM6 referenced this in commit bec6b5e19f on Jul 2, 2021UdjinM6 referenced this in commit a9fb8a57ab on Jul 2, 2021knst referenced this in commit e74373879b on Aug 10, 2021knst referenced this in commit a4062f57d9 on Aug 10, 2021knst referenced this in commit 705d36cd39 on Aug 16, 2021PastaPastaPasta referenced this in commit 42d1b0ba71 on Aug 23, 2021christiancfifi referenced this in commit b33ca8474a on Aug 27, 2021christiancfifi referenced this in commit 74858f06b4 on Aug 27, 2021christiancfifi referenced this in commit 33876d2450 on Aug 28, 2021christiancfifi referenced this in commit 1feb306462 on Aug 29, 2021christiancfifi referenced this in commit bfd9852f90 on Aug 29, 2021christiancfifi referenced this in commit b9d2e81286 on Aug 29, 2021MarcoFalke locked this on Sep 8, 2021
ken2812221 qmma70 Empact DrahtBot jezzalladmins MarcoFalke sipa laanwjLabels
RefactoringMilestone
0.17.0
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: 2024-11-17 12:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me