test: Use std::unique_ptr over manual delete in coins_tests #27004

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2301-test-uniq-ptr-🕴 changing 1 files +17 −37
  1. maflcko commented at 10:18 AM on January 31, 2023: member

    Makes the code smaller and easier to read

  2. DrahtBot commented at 10:18 AM on January 31, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, john-moffett

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  3. DrahtBot added the label Tests on Jan 31, 2023
  4. test: Use std::unique_ptr over manual delete in coins_tests fab9f7d1bd
  5. maflcko force-pushed on Jan 31, 2023
  6. fanquake requested review from stickies-v on Feb 2, 2023
  7. in src/test/coins_tests.cpp:917 in fab9f7d1bd
     913 | @@ -928,7 +914,7 @@ void TestFlushBehavior(
     914 |      auto flush_all = [&all_caches](bool erase) {
     915 |          // Flush in reverse order to ensure that flushes happen from children up.
     916 |          for (auto i = all_caches.rbegin(); i != all_caches.rend(); ++i) {
     917 | -            auto cache = *i;
     918 | +            auto& cache = *i;
    


    stickies-v commented at 3:24 PM on February 2, 2023:

    nit

                auto& cache{*i};
    
  8. stickies-v approved
  9. stickies-v commented at 3:35 PM on February 2, 2023: contributor

    ACK fab9f7d1bd48198d3e0d3c3a08e404ea73a2bc8d

    Not having to worry about dynamically allocated memory is 👍 Can't see any behaviour change.

  10. fanquake requested review from john-moffett on Feb 2, 2023
  11. john-moffett approved
  12. john-moffett commented at 4:43 PM on February 2, 2023: contributor

    ACK fab9f7d1bd48198d3e0d3c3a08e404ea73a2bc8d

    Definite improvement. No issues or behavior changes I can see.

  13. fanquake merged this on Feb 2, 2023
  14. fanquake closed this on Feb 2, 2023

  15. maflcko deleted the branch on Feb 3, 2023
  16. sidhujag referenced this in commit 68e3f79a05 on Feb 3, 2023
  17. bitcoin locked this on Feb 3, 2024

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: 2026-04-24 09:14 UTC

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