-
Notifications
You must be signed in to change notification settings - Fork 1.4k
zebra: Fix release_srv6_sid_func_explicit to return int instead of bool
#20446
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
base: master
Are you sure you want to change the base?
Conversation
|
@Mergifyio backport stable/10.5 stable/10.4 stable/10.3 stable/10.2 |
🟠 Waiting for conditions to matchDetails
|
release_srv6_sid_func_explicit to return bool instead of intrelease_srv6_sid_func_explicit to return int instead of bool
The function `release_srv6_sid_func_explicit` is declared to return a bool, but its implementation returns an int. This commit updates the function signature to return int instead of bool. Signed-off-by: Carmine Scarpitta <[email protected]>
6c6c518 to
0d2d7a0
Compare
| */ | ||
| static bool release_srv6_sid_func_explicit(struct zebra_srv6_sid_block *block, | ||
| static int release_srv6_sid_func_explicit(struct zebra_srv6_sid_block *block, | ||
| uint32_t sid_func, | ||
| uint32_t sid_wide_func) |
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.
If this function really returns a bool (which seems the case), it would be better to actually go the other way (change the implementation to use bool)
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.
it should be both, right?
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.
sigh I just looked at this closer.
0 was returned as a success, but would be interpreted as false as a bool.
-1 was returned as a failure, but would be interpreted as true as a bool.
I see no problem as a bool( but the returns should be reversed ). Frankly it sure seems like every place this function is called should actually be looked at and time taken to ensure the return code is used correctly.
Also since this function returned a bool and only every 0 and -1 were ever returned a bool is preferable in my mind rather than the awful c weirdness of 0 meaning success.
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.
Right, this function is never checked for the return status, so it sounds like a no-op?
|
Why backport tags? |
The function
release_srv6_sid_func_explicitis declared to return a bool, but its implementation returns an int.This PR updates the function signature to return int instead of bool.