Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ethomson
Copy link
Member

Return int from all the functions that aren't dispose or free functions. This allows us to gracefully fail on bad inputs (instead of an assert or crashing with a segmentation fault).

Only functions that cannot fail will remain void. This includes:

  • *_dispose and *_free: which should gracefully take NULL pointers, 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)

Copy link
Member

@pks-t pks-t left a 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;
Copy link
Member

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;
Copy link
Member

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.
@ethomson
Copy link
Member Author

Fixed! Thanks for the review @pks-t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants