use const references where appropriate #6206
pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:network changing 21 files +61 −63-
Diapolo commented at 1:39 pm on May 31, 2015: none
-
laanwj commented at 8:05 am on June 1, 2015: member
There are still a lot of these cases where a const reference can be used for strings throughout the source code. Instead of many little pulls I’d prefer (for post-0.11) a pull where they’re all addressed at once.
A quick
git grep string -- \*.h|grep -v '&'
shows at least:- FormatParagraph
- CAlert::AppliesTo
- ParseScript()
- GetWarnings()
- ParseNetwork()
- CRPCTable::operator[](std::string name)
- CRPCTable::help(std::string name)
- HelpExampleCli
- HelpExampleRpc
- runCommand()
- CWallet::GetAccountAddresses
- CWallet::CWallet(std::string strWalletFileIn)
- CValidationState::Error
CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false)
-
laanwj added the label Improvement on Jun 1, 2015
-
Diapolo commented at 8:50 am on June 1, 2015: noneI’m going to update this :).
-
Diapolo commented at 9:09 am on June 1, 2015: noneParseNetwork() isn’t suitable, because we use
boost::to_lower(net);
inside. -
Diapolo renamed this:
[net] make AddOneShot take a const reference
use const references where appropriate
on Jun 1, 2015 -
in src/net.cpp: in 551deda9ed outdated
1905@@ -1906,7 +1906,7 @@ bool CAddrDB::Read(CAddrMan& addr) 1906 unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); } 1907 unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); } 1908 1909-CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fInboundIn) : 1910+CNode::CNode(const SOCKET& hSocketIn, const CAddress& addrIn, const std::string& addrNameIn, bool fInboundIn) :
laanwj commented at 9:41 am on June 1, 2015:No need to do this for SOCKET, which is just an integer handle.
Diapolo commented at 9:50 am on June 1, 2015:You are right, reverted for hSocketIn :), thanks.laanwj commented at 11:25 am on June 1, 2015: memberutACKlaanwj commented at 11:28 am on June 1, 2015: memberI’m going to attach a second squashme pull, which covers BOOST_FOREACH and updated to constant refs if appropriate, if you want me to do so?
Yes, why not
Diapolo commented at 8:31 am on June 2, 2015: noneThat’s fine, could be I forgot a few cases in the GUI code, but that can be a seperate pull.fanquake commented at 2:48 pm on June 3, 2015: memberutACKlaanwj commented at 4:48 pm on June 4, 2015: memberWill merge after rebase. @diapolo can you please includegetValStr()
https://github.com/bitcoin/bitcoin/blob/master/src/univalue/univalue.h#L64 to return a const reference?use const references where appropriate a9ac95c1bclaanwj merged this on Jun 5, 2015laanwj closed this on Jun 5, 2015
laanwj referenced this in commit 3fce72eaa3 on Jun 5, 2015Diapolo deleted the branch on Jun 5, 2015zkbot referenced this in commit df07f9ad23 on Feb 15, 2017zkbot referenced this in commit ec069ce96c on Mar 3, 2017zkbot referenced this in commit 702eefc71a on Mar 3, 2017zkbot referenced this in commit 99c4c6de0c on Mar 3, 2017MarcoFalke locked this on Sep 8, 2021Labels
Refactoring
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-12-19 00:12 UTC
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-12-19 00:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me