Add some const qualifiers to references that are not modified and should be marked as const.
[trivial] Add missing const qualifiers. #7977
pull domob1812 wants to merge 1 commits into bitcoin:master from domob1812:consts changing 3 files +4 −4-
domob1812 commented at 11:22 AM on April 30, 2016: contributor
- MarcoFalke added the label Refactoring on Apr 30, 2016
-
f7c4f79f07
[trivial] Add missing const qualifiers.
Add some const qualifiers to references that are not modified and should be marked as const.
-
in src/txmempool.h:None in 1a7539b7fc outdated
671 | @@ -672,10 +672,10 @@ class CTxMemPool 672 | class CCoinsViewMemPool : public CCoinsViewBacked 673 | { 674 | protected: 675 | - CTxMemPool &mempool; 676 | + const CTxMemPool &mempool; 677 | 678 | public: 679 | - CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn); 680 | + CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn);
MarcoFalke commented at 4:17 PM on April 30, 2016:nit: If you do trivial fixes, please also do all other trivial fixes in the same line:
diff --git a/src/main.cpp b/src/main.cpp index ed34137..2777245 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1471 +1471 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, const Consensus::P - const CCoinsViewCache &view = *pcoinsTip; + const CCoinsViewCache& view = *pcoinsTip; diff --git a/src/txmempool.h b/src/txmempool.h index c991514..d17e332 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -675 +675 @@ protected: - const CTxMemPool &mempool; + const CTxMemPool& mempool; @@ -678 +678 @@ public: - CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn); + CCoinsViewMemPool(CCoinsView* baseIn, const CTxMemPool& mempoolIn);
domob1812 commented at 4:37 PM on April 30, 2016:I agree but was not aware that there is a general style preference of
uint256& hashoveruint256 &hash. I personally like the former better, but did not want to reformat "someone else's" code. Is the former explicitly preferred in Bitcoin sources? (Which are not always consistent in style.)
MarcoFalke commented at 5:17 PM on April 30, 2016:It is not really important to get every white space "correct" but you can read about the general preferred code style over here: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#developer-notes
domob1812 commented at 5:27 PM on April 30, 2016:Thanks for the heads-up, I've updated the patch now. This is not explicitly mentioned in the doc, but the example code block uses the
uint256& hashstyle.
MarcoFalke commented at 5:33 PM on April 30, 2016:If you don't want to do that manually, you can just do
$ git diff HEAD~ -U0|cfd. Wherecfdis an alias for./contrib/devtools/clang-format-diff.py -p1 -i -v.domob1812 force-pushed on Apr 30, 2016dcousens commented at 1:18 AM on May 2, 2016: contributorutACK f7c4f79
paveljanik commented at 5:10 AM on May 2, 2016: contributorMarcoFalke commented at 11:01 AM on May 2, 2016: memberutACK f7c4f79
laanwj merged this on May 5, 2016laanwj closed this on May 5, 2016laanwj referenced this in commit e8d917591f on May 5, 2016domob1812 deleted the branch on May 5, 2016codablock referenced this in commit 38e5e8ee93 on Sep 16, 2017codablock referenced this in commit 6a4cc3ef4e on Sep 19, 2017codablock referenced this in commit f8ad2ffa79 on Dec 20, 2017DrahtBot locked this on Sep 8, 2021ContributorsLabels
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-21 18:15 UTC
More mirrored repositories can be found on mirror.b10c.me