We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In class Subscription.hpp, check for empty field _node can be called two or three times in a row. For example, method updated():
_node
updated()
bool updated() { if (!valid()) { subscribe(); } return valid() ? Manager::updates_available(_node, _last_generation) : false; }
Method valid contains check for empty _node: bool valid() const { return _node != nullptr; }
valid
bool valid() const { return _node != nullptr; }
Method subscribe has the same check:
subscribe
bool Subscription::subscribe() { if (_node != nullptr) { return true; } ...
Means, check _node != nullptr can be called two or three times in a row.
_node != nullptr
Only subscribe method is used for _node emptiness check. Performance and code readability will be improved.
Current version is working fine.
No response
The text was updated successfully, but these errors were encountered:
Duplicate empty _node check removed from Subscription.hpp (PX4#23316)
1abb189
No branches or pull requests
Describe problem solved by the proposed feature
In class Subscription.hpp, check for empty field
_node
can be called two or three times in a row.For example, method
updated()
:Method
valid
contains check for empty_node
:bool valid() const { return _node != nullptr; }
Method
subscribe
has the same check:Means, check
_node != nullptr
can be called two or three times in a row.Describe your preferred solution
Only
subscribe
method is used for_node
emptiness check.Performance and code readability will be improved.
Describe possible alternatives
Current version is working fine.
Additional context
No response
The text was updated successfully, but these errors were encountered: