Small refactoring of iterator type declaration #28073

pull Lehonti wants to merge 2 commits into bitcoin:master from Lehonti:master changing 1 files +10 −8
  1. Lehonti commented at 12:36 PM on July 13, 2023: none

    There are a few functions in httpserver.cpp (HTTPBindAddresses and UnregisterHTTPHandler) that are declaring std::vector::iterator explicitly, which is really verbose and visually noisy. My guess is that they were written pre-C++11 and they would be written differently today, so I modified them a little and used auto instead.

    Also, I inverted the logic of an if block in UnregisterHTTPHandler in order to remove a nesting level.

  2. substituted explicit type declaration of iterator for auto in httpserver e7df714e55
  3. DrahtBot commented at 12:36 PM on July 13, 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. A summary of reviews will appear here.

  4. Fixed compilation errors related to variable scope 9fb9856064
  5. DrahtBot added the label CI failed on Jul 13, 2023
  6. maflcko commented at 12:54 PM on July 13, 2023: member

    Thank you for your contribution. While this stylistic change makes sense on its own, it comes at a cost and risk for the project as a whole. The weak motivation for the change does not justify the burden that it places on the project. A burden could be any of the following:

    • Time spent on review
    • Accidental introduction of bugs
    • (Silent) merge conflicts, either in the branch or a backport branch. Those conflicts demand further developer and reviewer time or introduce bugs.

    For more information about refactoring changes and stylistic cleanup, see

    Generally, if the style is not mentioned nor enforced by the developer notes, we leave it up to the original author to pick whatever fits them best personally and then leave it that way until the line is touched for other reasons.

    Let us know if you have any questions.

  7. in src/httpserver.cpp:333 in 9fb9856064
     329 | @@ -330,7 +330,7 @@ static bool HTTPBindAddresses(struct evhttp* http)
     330 |      }
     331 |  
     332 |      // Bind addresses
     333 | -    for (std::vector<std::pair<std::string, uint16_t> >::iterator i = endpoints.begin(); i != endpoints.end(); ++i) {
     334 | +    for (auto i = endpoints.begin(); i != endpoints.end(); ++i) {
    


    maflcko commented at 12:55 PM on July 13, 2023:

    Should probably use the C++17 structured bindings, but again, probably not worth to change it, unless there are other changes

  8. maflcko commented at 12:57 PM on July 13, 2023: member

    Closing for now. If you are looking for something else to work on, see:

    Getting started to contribute to Bitcoin Core

    Setting up your development environment

    New developers are very welcome and needed. There are a lot of open issues of any difficulty waiting to be fixed. However, before you start contributing, familiarize yourself with the Bitcoin Core build system and tests. Refer to the documentation in the repository on how to build Bitcoin Core and how to run the unit and functional tests. Once that is done, you are all set.

    If you need more help getting started, please refer to the following resources:

    Pick something to work on

    If you are looking for useful contributions to help out with, you can

    • Search through the good first issues or the ones that are up for grabs. Some of them might no longer be applicable. So if you are interested, but unsure, you might want to leave a comment on the issue first.
    • Write tests to improve the coverage. Any kind of test is welcome and coverage information can be obtained from a relatively recent coverage report. If you are unsure, don't hesitate to check back first.
    • Help with review and testing. There are easy ones such as the gui and rpc. However, review on any open pull request is welcome. Review will also help you understand the codebase better.
    • Help on meta projects related to Bitcoin Core, such as a high-level performance monitor.
    • Join us on irc and let us know what you are interested in.
  9. maflcko closed this on Jul 13, 2023

  10. bitcoin locked this on Jul 12, 2024
Labels

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-28 00:13 UTC

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