Class member variables have a
m_prefix.
Refactor data members of CBloomFilter and CRollingBloomFilter following the above convention to make them more obvious to maintainers.
Class member variables have a
m_prefix.
Refactor data members of CBloomFilter and CRollingBloomFilter following the above convention to make them more obvious to maintainers.
56 | {
57 | - if (isFull)
58 | + if (m_isFull)
59 | return;
60 | - for (unsigned int i = 0; i < nHashFuncs; i++)
61 | + for (unsigned int i = 0; i < m_nHashFuncs; ++i)
Unnecessary to increment the counter here.
35 | - isFull(false), 36 | - isEmpty(true), 37 | - nHashFuncs(std::min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)), 38 | - nTweak(nTweakIn), 39 | - nFlags(nFlagsIn) 40 | + m_isFull(false),
The code is follow camelCase and you are changing it to underscore_case. Bad decision. Follow the current style.
The m_ convention denotes that the variable is a data member of the class. It is an aid for maintainers to avoid creating side effects by mistake. It doesn't contradict with the current style.
I understand! Thanks!
271 | + m_data[p] = p1 & mask; 272 | + m_data[p + 1] = p2 & mask; 273 | } 274 | } 275 | - nEntriesThisGeneration++; 276 | + ++m_nEntriesThisGeneration;
Prefix is unnecessary. Can you explain?
NACK, per developer guidelines, do not submit patches that purely improve style.
251 | - if (nGeneration == 4) { 252 | - nGeneration = 1; 253 | + if (m_nEntriesThisGeneration == m_nEntriesPerGeneration) { 254 | + m_nEntriesThisGeneration = 0; 255 | + ++m_nGeneration; 256 | + if (m_nGeneration == 4) {
4 should be in a enum so we understand the meaning
252 | - nGeneration = 1; 253 | + if (m_nEntriesThisGeneration == m_nEntriesPerGeneration) { 254 | + m_nEntriesThisGeneration = 0; 255 | + ++m_nGeneration; 256 | + if (m_nGeneration == 4) { 257 | + m_nGeneration = 1;
Same with 1. Needs to be a constant in some enum
Thanks, however please read through https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#refactoring.