Skip to content

Commit

Permalink
Use handle directly in ReleaseHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
bording committed Nov 23, 2024
1 parent 1e028f7 commit d1c26a3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
50 changes: 25 additions & 25 deletions LibGit2Sharp/Core/Handles/Objects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal TreeEntryHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_tree_entry_free((git_tree_entry*)AsIntPtr());
NativeMethods.git_tree_entry_free((git_tree_entry*)handle);

return true;
}
Expand All @@ -43,7 +43,7 @@ internal ReferenceHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_reference_free((git_reference*)AsIntPtr());
NativeMethods.git_reference_free((git_reference*)handle);

return true;
}
Expand All @@ -68,7 +68,7 @@ internal RepositoryHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_repository_free((git_repository*)AsIntPtr());
NativeMethods.git_repository_free((git_repository*)handle);

return true;
}
Expand All @@ -93,7 +93,7 @@ internal SignatureHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_signature_free((git_signature*)AsIntPtr());
NativeMethods.git_signature_free((git_signature*)handle);

return true;
}
Expand All @@ -118,7 +118,7 @@ internal StatusListHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_status_list_free((git_status_list*)AsIntPtr());
NativeMethods.git_status_list_free((git_status_list*)handle);

return true;
}
Expand All @@ -143,7 +143,7 @@ internal BlameHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_blame_free((git_blame*)AsIntPtr());
NativeMethods.git_blame_free((git_blame*)handle);

return true;
}
Expand All @@ -168,7 +168,7 @@ internal DiffHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_diff_free((git_diff*)AsIntPtr());
NativeMethods.git_diff_free((git_diff*)handle);

return true;
}
Expand All @@ -193,7 +193,7 @@ internal PatchHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_patch_free((git_patch*)AsIntPtr());
NativeMethods.git_patch_free((git_patch*)handle);

return true;
}
Expand All @@ -218,7 +218,7 @@ internal ConfigurationHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_config_free((git_config*)AsIntPtr());
NativeMethods.git_config_free((git_config*)handle);

return true;
}
Expand All @@ -243,7 +243,7 @@ internal ConflictIteratorHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_index_conflict_iterator_free((git_index_conflict_iterator*)AsIntPtr());
NativeMethods.git_index_conflict_iterator_free((git_index_conflict_iterator*)handle);

return true;
}
Expand All @@ -268,7 +268,7 @@ internal IndexHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_index_free((git_index*)AsIntPtr());
NativeMethods.git_index_free((git_index*)handle);

return true;
}
Expand All @@ -293,7 +293,7 @@ internal ReflogHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_reflog_free((git_reflog*)AsIntPtr());
NativeMethods.git_reflog_free((git_reflog*)handle);

return true;
}
Expand All @@ -318,7 +318,7 @@ internal TreeBuilderHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_treebuilder_free((git_treebuilder*)AsIntPtr());
NativeMethods.git_treebuilder_free((git_treebuilder*)handle);

return true;
}
Expand All @@ -343,7 +343,7 @@ internal PackBuilderHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_packbuilder_free((git_packbuilder*)AsIntPtr());
NativeMethods.git_packbuilder_free((git_packbuilder*)handle);

return true;
}
Expand All @@ -368,7 +368,7 @@ internal NoteHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_note_free((git_note*)AsIntPtr());
NativeMethods.git_note_free((git_note*)handle);

return true;
}
Expand All @@ -393,7 +393,7 @@ internal DescribeResultHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_describe_result_free((git_describe_result*)AsIntPtr());
NativeMethods.git_describe_result_free((git_describe_result*)handle);

return true;
}
Expand All @@ -418,7 +418,7 @@ internal SubmoduleHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_submodule_free((git_submodule*)AsIntPtr());
NativeMethods.git_submodule_free((git_submodule*)handle);

return true;
}
Expand All @@ -443,7 +443,7 @@ internal AnnotatedCommitHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_annotated_commit_free((git_annotated_commit*)AsIntPtr());
NativeMethods.git_annotated_commit_free((git_annotated_commit*)handle);

return true;
}
Expand All @@ -468,7 +468,7 @@ internal ObjectDatabaseHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_odb_free((git_odb*)AsIntPtr());
NativeMethods.git_odb_free((git_odb*)handle);

return true;
}
Expand All @@ -493,7 +493,7 @@ internal RevWalkerHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_revwalk_free((git_revwalk*)AsIntPtr());
NativeMethods.git_revwalk_free((git_revwalk*)handle);

return true;
}
Expand All @@ -518,7 +518,7 @@ internal RemoteHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_remote_free((git_remote*)AsIntPtr());
NativeMethods.git_remote_free((git_remote*)handle);

return true;
}
Expand All @@ -543,7 +543,7 @@ internal ObjectHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_object_free((git_object*)AsIntPtr());
NativeMethods.git_object_free((git_object*)handle);

return true;
}
Expand All @@ -568,7 +568,7 @@ internal RebaseHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_rebase_free((git_rebase*)AsIntPtr());
NativeMethods.git_rebase_free((git_rebase*)handle);

return true;
}
Expand All @@ -593,7 +593,7 @@ internal OdbStreamHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_odb_stream_free((git_odb_stream*)AsIntPtr());
NativeMethods.git_odb_stream_free((git_odb_stream*)handle);

return true;
}
Expand All @@ -618,7 +618,7 @@ internal WorktreeHandle(IntPtr ptr, bool owned)

protected override bool ReleaseHandle()
{
NativeMethods.git_worktree_free((git_worktree*)AsIntPtr());
NativeMethods.git_worktree_free((git_worktree*)handle);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/Handles/Objects.tt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ for (var i = 0; i < cNames.Length; i++)

protected override bool ReleaseHandle()
{
NativeMethods.<#= cNames[i] #>_free((<#= cNames[i] #>*)AsIntPtr());
NativeMethods.<#= cNames[i] #>_free((<#= cNames[i] #>*)handle);

return true;
}
Expand Down

0 comments on commit d1c26a3

Please sign in to comment.