-
Notifications
You must be signed in to change notification settings - Fork 964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improves ignore messages in Router.cpp #4442
Improves ignore messages in Router.cpp #4442
Conversation
charlieh0tel
commented
Aug 11, 2024
- Improves ignore messages in Router.cpp
- Cleans up flow using standard "goto out" pattern to handle cleanup.
|
I'm a big fan of guard clauses, but less of a fan of goto statements. Perhaps we can take a similar approach in the if blocks but instead of the goto we can do early return ala:
|
The Linux kernel uses to goto pattern because it avoids copypasta, which has been demonstrated to cause bugs. But I will change it to copypasta + nlx per your request. |
In my experience if copypasta is concern, it's typically a code-smell that extracting a method to encapsulate the duplicated behavior is called for. That could also be a QoL change as a part of this cleanup. FWIW, I understand gotos can be used effectively, but I've also seen them used to create some truly awful spaghetti code. We've gotten this far without using them, so I'd rather not open pandora's box. 😅 |
Signed-off-by: Christopher Hoover <[email protected]> .
d06f413
to
9efd493
Compare
I did it the copypasta + nlx way you requested. I think it is ready to merge. PTAL. |
Caught up to head of master. Should be good to go. PTAL @thebentern |