Skip to content

Improve marshaling of git oid #682

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

Merged
merged 1 commit into from
Apr 23, 2014
Merged

Conversation

kgybels
Copy link

@kgybels kgybels commented Apr 21, 2014

Doing a simple copy of the byte array is a lot faster than using
Marshal.PtrToStructure.

Doing a simple copy of the byte array is a lot faster than using
Marshal.PtrToStructure.
return IsInvalid ? null : (GitOid?)MarshalAsGitOid(handle);
}

private static GitOid MarshalAsGitOid(System.IntPtr data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a bool throwWhenNull = true parameter (à la IntPtrExtensions)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nulltoken I don't see why that is needed, the code already returns null when the handle is invalid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh.... You're right! I overlooked that this was a private function (unlike MarshalAs<>()).

@nulltoken nulltoken merged commit 35e9a66 into libgit2:vNext Apr 23, 2014
@nulltoken
Copy link
Member

Thanks!

✨ ✨ ✨ ✨

@nulltoken nulltoken added this to the v0.18.0 milestone Apr 23, 2014
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.

2 participants