GitHub PullRequestReviewCommentEvent at 2014-06-25 10:06:40
Repository: libgit2sharp
Actor: Therzok
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/14177381","id":14177381,"diff_hunk":"@@ -0,0 +1,48 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Runtime.InteropServices;\n+\n+namespace LibGit2Sharp.Core\n+{\n+    /// <summary>\n+    /// A git_strarray where the string array and strings themselves were allocated\n+    /// with libgit2's allocator. Only libgit2 can free this git_strarray.\n+    /// </summary>\n+    [StructLayout(LayoutKind.Sequential)]\n+    internal struct GitStrArrayNative : IDisposable\n+    {\n+        public GitStrArray Array;\n+\n+        /// <summary>\n+        /// Enumerates each string from the array using the UTF-8 marshaler.\n+        /// </summary>\n+        public String[] ReadStrings()\n+        {\n+            int count = (int)Array.Count.ToUInt32();\n+\n+            if (count < 0)\n+            {\n+                throw new OverflowException();\n+            }\n+\n+            String[] toReturn = new String[count];\n+\n+            for (int i = 0; i < count; i++)\n+            {\n+                toReturn[i] = LaxUtf8Marshaler.FromNative(Marshal.ReadIntPtr(Array.Strings, i * IntPtr.Size));\n+            }\n+\n+            return toReturn;\n+        }\n+\n+        public void Dispose()\n+        {\n+            if (IntPtr.Zero != Array.Strings)\n+            {\n+                NativeMethods.git_strarray_free(ref Array);\n+            }\n+\n+            Array = new GitStrArray();","path":"LibGit2Sharp/Core/GitStrArrayNative.cs","position":45,"original_position":45,"commit_id":"a8dc479f5bbfb4c17129c133d0503c495eff63c0","original_commit_id":"a8dc479f5bbfb4c17129c133d0503c495eff63c0","user":{"login":"Therzok","id":109974,"avatar_url":"https://avatars.githubusercontent.com/u/109974?","gravatar_id":"7927d188db48682536d20e13c07fa1e8","url":"https://api.github.com/users/Therzok","html_url":"https://github.com/Therzok","followers_url":"https://api.github.com/users/Therzok/followers","following_url":"https://api.github.com/users/Therzok/following{/other_user}","gists_url":"https://api.github.com/users/Therzok/gists{/gist_id}","starred_url":"https://api.github.com/users/Therzok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Therzok/subscriptions","organizations_url":"https://api.github.com/users/Therzok/orgs","repos_url":"https://api.github.com/users/Therzok/repos","events_url":"https://api.github.com/users/Therzok/events{/privacy}","received_events_url":"https://api.github.com/users/Therzok/received_events","type":"User","site_admin":false},"body":"Same here with the Disposable pattern.","created_at":"2014-06-25T10:06:40Z","updated_at":"2014-06-25T10:06:40Z","html_url":"https://github.com/libgit2/libgit2sharp/pull/773#discussion_r14177381","pull_request_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/14177381"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/773#discussion_r14177381"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773","id":17551368,"html_url":"https://github.com/libgit2/libgit2sharp/pull/773","diff_url":"https://github.com/libgit2/libgit2sharp/pull/773.diff","patch_url":"https://github.com/libgit2/libgit2sharp/pull/773.patch","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/773","number":773,"state":"open","title":"git_strarray marshaling improvements","user":{"login":"phkelley","id":1985886,"avatar_url":"https://avatars.githubusercontent.com/u/1985886?","gravatar_id":"4d49a633c05a77201fd30976259ca946","url":"https://api.github.com/users/phkelley","html_url":"https://github.com/phkelley","followers_url":"https://api.github.com/users/phkelley/followers","following_url":"https://api.github.com/users/phkelley/following{/other_user}","gists_url":"https://api.github.com/users/phkelley/gists{/gist_id}","starred_url":"https://api.github.com/users/phkelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phkelley/subscriptions","organizations_url":"https://api.github.com/users/phkelley/orgs","repos_url":"https://api.github.com/users/phkelley/repos","events_url":"https://api.github.com/users/phkelley/events{/privacy}","received_events_url":"https://api.github.com/users/phkelley/received_events","type":"User","site_admin":false},"body":"I noticed that `GitStrArrayOut`'s `Dispose` method was implemented incorrectly -- fixing that led me down this path towards trying to unify our `GitStrArray` types and clean things up. We still end up with two different types, `GitStrArrayManaged` and `GitStrArrayNative`, which correspond to the old In and Out types, respectively. But this PR switches to structs, gives a bit more code re-use, fixes some bugs, and manages to eliminate the `UnSafeNativeMethods` class entirely!\r\n\r\nI'm eager to get the Mono results...","created_at":"2014-06-24T19:13:01Z","updated_at":"2014-06-25T10:06:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44949ebe2ee7c005c20cd7dd09e7632424695831","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/773/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/a8dc479f5bbfb4c17129c133d0503c495eff63c0","head":{"label":"libgit2:strarray","ref":"strarray","sha":"a8dc479f5bbfb4c17129c133d0503c495eff63c0","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":1415168,"name":"libgit2sharp","full_name":"libgit2/libgit2sharp","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2sharp","forks_url":"https://api.github.com/repos/libgit2/libgit2sharp/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments/{number}","contents_url":"https://api.github.com/repos/libgit2/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2sharp/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2sharp/releases{/id}","created_at":"2011-02-26T16:44:49Z","updated_at":"2014-06-24T21:26:39Z","pushed_at":"2014-06-24T21:26:39Z","git_url":"git://github.com/libgit2/libgit2sharp.git","ssh_url":"git@github.com:libgit2/libgit2sharp.git","clone_url":"https://github.com/libgit2/libgit2sharp.git","svn_url":"https://github.com/libgit2/libgit2sharp","homepage":"http://libgit2.github.com","size":153867,"stargazers_count":557,"watchers_count":557,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":214,"mirror_url":null,"open_issues_count":104,"forks":214,"open_issues":104,"watchers":557,"default_branch":"vNext"}},"base":{"label":"libgit2:vNext","ref":"vNext","sha":"2378a56fadea4b9cdd57e0abead4c5fd061567bc","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":1415168,"name":"libgit2sharp","full_name":"libgit2/libgit2sharp","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?","gravatar_id":"1c56acccc41c591705dc92da5f6ab603","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2sharp","forks_url":"https://api.github.com/repos/libgit2/libgit2sharp/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments/{number}","contents_url":"https://api.github.com/repos/libgit2/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2sharp/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2sharp/releases{/id}","created_at":"2011-02-26T16:44:49Z","updated_at":"2014-06-24T21:26:39Z","pushed_at":"2014-06-24T21:26:39Z","git_url":"git://github.com/libgit2/libgit2sharp.git","ssh_url":"git@github.com:libgit2/libgit2sharp.git","clone_url":"https://github.com/libgit2/libgit2sharp.git","svn_url":"https://github.com/libgit2/libgit2sharp","homepage":"http://libgit2.github.com","size":153867,"stargazers_count":557,"watchers_count":557,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":214,"mirror_url":null,"open_issues_count":104,"forks":214,"open_issues":104,"watchers":557,"default_branch":"vNext"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/773"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/773"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/773/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/773/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/a8dc479f5bbfb4c17129c133d0503c495eff63c0"}}}}