Do not shadow variables in src/wallet #8191

pull paveljanik wants to merge 1 commits into bitcoin:master from paveljanik:20160611_shadowing_wallet changing 4 files +15 −15
  1. paveljanik commented at 2:38 pm on June 11, 2016: contributor

    Continues #8105.

    Review of this should be pretty straight forward. Just compare binaries. View the diff in visual diff or so.

    To provide tested ACK, cherrypick paveljanik@5d2f98e and compare master build log and this PR build log.

  2. jonasschnelli added the label Wallet on Jun 13, 2016
  3. jonasschnelli added the label Refactoring on Jun 13, 2016
  4. in src/wallet/db.cpp: in 0aa57286da outdated
    386@@ -387,7 +387,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
    387                         while (fSuccess) {
    388                             CDataStream ssKey(SER_DISK, CLIENT_VERSION);
    389                             CDataStream ssValue(SER_DISK, CLIENT_VERSION);
    390-                            int ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT);
    391+                            ret = db.ReadAtCursor(pcursor, ssKey, ssValue, DB_NEXT);
    


    laanwj commented at 12:25 pm on June 27, 2016:
    I’m not sure promoting these return values up to the function scope is a good idea. Keeping the scope of variables as small as possible ensures that results won’t leak or accidentally influence other things.

    paveljanik commented at 12:38 pm on June 27, 2016:

    Technically speaking, this is not directly function scope.

    But yes, one view is to have only one return value variable, the other is one return value variable per function call.

    Renaming ret to ret1 here could make this particular change smaller.


    laanwj commented at 12:44 pm on June 27, 2016:
    Yes, I’d prefer just renaming

    paveljanik commented at 12:58 pm on June 27, 2016:
    Done and squashed - now all the changes are of the same kind.
  5. paveljanik force-pushed on Jun 27, 2016
  6. MarcoFalke commented at 7:35 pm on June 29, 2016: member
    ACK: objdump -d $bin returns the same binaries for me on d5b25fa
  7. paveljanik commented at 6:58 pm on July 31, 2016: contributor
    more ACKs please
  8. sipa commented at 0:44 am on August 1, 2016: member
    utACK d5b25fa5792b3899759a73059a87c6b015fc8535
  9. Do not shadow variables. b175cb755b
  10. paveljanik force-pushed on Aug 31, 2016
  11. paveljanik commented at 2:17 pm on August 31, 2016: contributor
    Rebased.
  12. laanwj commented at 2:40 pm on August 31, 2016: member
    Also compared binaries, tACK b175cb7
  13. laanwj merged this on Aug 31, 2016
  14. laanwj closed this on Aug 31, 2016

  15. laanwj referenced this in commit abc677c9a9 on Aug 31, 2016
  16. codablock referenced this in commit 12238a31cd on Sep 19, 2017
  17. codablock referenced this in commit 562f41b7c8 on Jan 9, 2018
  18. codablock referenced this in commit 88fcf3fbd2 on Jan 9, 2018
  19. andvgal referenced this in commit 655bd76636 on Jan 6, 2019
  20. random-zebra referenced this in commit 46fad30bbb on Nov 15, 2020
  21. DrahtBot locked this on Sep 8, 2021

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 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me