-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Return int from non-free functions #5365
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
Conversation
ff1a1fb to
c1ce497
Compare
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.
Two minor style nits about indentation, but otherwise this looks good to me. Please feel free to merge as soon as those are fixed!
| git_index_name_clear(index); | ||
| if ((error = git_index_name_clear(index)) < 0 || | ||
| (error = git_index_reuc_clear(index)) < 0) | ||
| goto done; |
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.
Nit: indentation
| git_index_reuc_clear(index); | ||
| if ((error = git_index_name_clear(index)) < 0 || | ||
| (error = git_index_reuc_clear(index)) < 0) | ||
| goto done; |
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.
Here as well
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
Stop returning a void for functions, future-proofing them to allow them to fail.
c1ce497 to
4cae9e7
Compare
|
Fixed! Thanks for the review @pks-t |
Return
intfrom all the functions that aren'tdisposeorfreefunctions. This allows us to gracefully fail on bad inputs (instead of anassertor crashing with a segmentation fault).Only functions that cannot fail will remain void. This includes:
*_disposeand*_free: which should gracefully takeNULLpointers, ignore them, and continue.giterr_clear: which cannot fail (since it just updates pointers in global state)giterr_set_oom: which cannot fail (since it just updates pointers in global state)