-
Notifications
You must be signed in to change notification settings - Fork 163
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
Simplify the various 'is_valid' calls #1086
base: rolling
Are you sure you want to change the base?
Conversation
Users should be able to query whether a subscription is valid without having an error set. Only set an error if an invalid pointer (e.g. NULL) was passed in. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a client is valid without an error being set. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether an event is valid without an error being set. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a node is valid without setting an error. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a publisher is valid without it setting an error. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a service is valid without it setting an error. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a service event publisher is valid without it setting an error. Fix that here. Signed-off-by: Chris Lalancette <[email protected]>
A user should be able to query whether a wait_set is valid without it setting an error, which it already does. However, passing a NULL into it is logically invalid; we can't possibly answer that question. So set an error in that case. Signed-off-by: Chris Lalancette <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
just asking the question of whether it is valid should never return an error.
makes sense to me.
The more I look at this, the less I like it. If you are looking at these I'm going to turn this into a draft for now until I come up with something better. |
Currently if you call one of the rcl "is_valid" functions on an uninitialized pointer of the correct type, it will return false but it will also set an error. But this doesn't seem correct; just asking the question of whether it is valid should never return an error. This PR fixes that.
Note that if you pass a NULL pointer into the "is_valid" function, you'll still get an error set. That seems reasonable since you are basically asking a nonsense question.