Skip to content

Commit dce1367

Browse files
committed
Deploy Proxy.MarshalAs<T> more extensively
1 parent 8077fd2 commit dce1367

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

LibGit2Sharp/Core/Proxy.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public static BlameSafeHandle git_blame_file(
6161

6262
public static GitBlameHunk git_blame_get_hunk_byindex(BlameSafeHandle blame, uint idx)
6363
{
64-
GitBlameHunk hunk = new GitBlameHunk();
65-
Marshal.PtrToStructure(NativeMethods.git_blame_get_hunk_byindex(blame, idx), hunk);
66-
return hunk;
64+
return MarshalAs<GitBlameHunk>(NativeMethods.git_blame_get_hunk_byindex(blame, idx));
6765
}
6866

6967
public static void git_blame_free(IntPtr blame)
@@ -2798,7 +2796,7 @@ public static IList<GitRemoteHead> RemoteLsHelper(IntPtr heads, UIntPtr size)
27982796
var list = new List<GitRemoteHead>(count);
27992797
for (int i = 0; i < count; i++)
28002798
{
2801-
list.Add((GitRemoteHead)Marshal.PtrToStructure(rawHeads[i], typeof (GitRemoteHead)));
2799+
list.Add(MarshalAs<GitRemoteHead>(rawHeads[i]));
28022800
}
28032801
return list;
28042802
}

0 commit comments

Comments
 (0)