{"action":"created","comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/32636147","id":32636147,"diff_hunk":"@@ -132,55 +132,69 @@ auto tempCString(To = char, From)(From str)\n         }\n \n         To[256 / To.sizeof] _buff;  // the 'small string optimization'\n+\n+        static Res trustedVoidInit() { Res res = void; return res; }\n     }\n \n-    Res res = void;     // expensive to fill _buff[]\n+    Res res = Res.trustedVoidInit();     // expensive to fill _buff[]\n \n     // Note: res._ptr can't point to res._buff as structs are movable.\n \n-    import std.utf : byUTF;\n-\n-    To* p      = res._buff.ptr;\n-    size_t len = res.buffLength;\n+    To[] p = res._buff[0 .. Res.buffLength];\n     size_t i;\n \n+    static To[] trustedRealloc(To[] buf, size_t i, To* resptr, size_t strLength)\n+        @trusted @nogc nothrow","path":"std/internal/cstring.d","position":46,"original_position":46,"commit_id":"e1b6c4f84f7dc38cd1d83443d640efa0bb6d8cae","original_commit_id":"e1b6c4f84f7dc38cd1d83443d640efa0bb6d8cae","user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"body":"Given how trustedRealloc may invalidate buf, I think the better interface is to take it as a ref, to avoid issues where the caller doesn't re-assign it. Otherwise, you are left with a dangling pointer. This doesn't prevent all mistakes, but it does support the common case.","created_at":"2015-06-17T15:03:23Z","updated_at":"2015-06-17T15:03:23Z","html_url":"https://github.com/D-Programming-Language/phobos/pull/3417#discussion_r32636147","pull_request_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417","_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/32636147"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/3417#discussion_r32636147"},"pull_request":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417"}}},"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417","id":37881954,"html_url":"https://github.com/D-Programming-Language/phobos/pull/3417","diff_url":"https://github.com/D-Programming-Language/phobos/pull/3417.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/3417.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3417","number":3417,"state":"open","locked":false,"title":"get tempCString to infer @trusted","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"body":"This refactoring is done so that @safe-ty can be inferred from the range input type.","created_at":"2015-06-17T09:36:58Z","updated_at":"2015-06-17T15:03:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7ae853b99f17b420bf9e9d08db2450b470c8f77","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417/comments","review_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3417/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/e1b6c4f84f7dc38cd1d83443d640efa0bb6d8cae","head":{"label":"WalterBright:rangecstring3","ref":"rangecstring3","sha":"e1b6c4f84f7dc38cd1d83443d640efa0bb6d8cae","user":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"repo":{"id":7236335,"name":"phobos","full_name":"WalterBright/phobos","owner":{"login":"WalterBright","id":568298,"avatar_url":"https://avatars.githubusercontent.com/u/568298?v=3","gravatar_id":"","url":"https://api.github.com/users/WalterBright","html_url":"https://github.com/WalterBright","followers_url":"https://api.github.com/users/WalterBright/followers","following_url":"https://api.github.com/users/WalterBright/following{/other_user}","gists_url":"https://api.github.com/users/WalterBright/gists{/gist_id}","starred_url":"https://api.github.com/users/WalterBright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WalterBright/subscriptions","organizations_url":"https://api.github.com/users/WalterBright/orgs","repos_url":"https://api.github.com/users/WalterBright/repos","events_url":"https://api.github.com/users/WalterBright/events{/privacy}","received_events_url":"https://api.github.com/users/WalterBright/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WalterBright/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/WalterBright/phobos","forks_url":"https://api.github.com/repos/WalterBright/phobos/forks","keys_url":"https://api.github.com/repos/WalterBright/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WalterBright/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WalterBright/phobos/teams","hooks_url":"https://api.github.com/repos/WalterBright/phobos/hooks","issue_events_url":"https://api.github.com/repos/WalterBright/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/WalterBright/phobos/events","assignees_url":"https://api.github.com/repos/WalterBright/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/WalterBright/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/WalterBright/phobos/tags","blobs_url":"https://api.github.com/repos/WalterBright/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WalterBright/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WalterBright/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/WalterBright/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WalterBright/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/WalterBright/phobos/languages","stargazers_url":"https://api.github.com/repos/WalterBright/phobos/stargazers","contributors_url":"https://api.github.com/repos/WalterBright/phobos/contributors","subscribers_url":"https://api.github.com/repos/WalterBright/phobos/subscribers","subscription_url":"https://api.github.com/repos/WalterBright/phobos/subscription","commits_url":"https://api.github.com/repos/WalterBright/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/WalterBright/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/WalterBright/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/WalterBright/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/WalterBright/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/WalterBright/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WalterBright/phobos/merges","archive_url":"https://api.github.com/repos/WalterBright/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WalterBright/phobos/downloads","issues_url":"https://api.github.com/repos/WalterBright/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/WalterBright/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/WalterBright/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/WalterBright/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WalterBright/phobos/labels{/name}","releases_url":"https://api.github.com/repos/WalterBright/phobos/releases{/id}","created_at":"2012-12-19T06:55:07Z","updated_at":"2015-05-07T22:30:01Z","pushed_at":"2015-06-17T10:31:17Z","git_url":"git://github.com/WalterBright/phobos.git","ssh_url":"git@github.com:WalterBright/phobos.git","clone_url":"https://github.com/WalterBright/phobos.git","svn_url":"https://github.com/WalterBright/phobos","homepage":"dlang.org/phobos","size":44369,"stargazers_count":3,"watchers_count":3,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"D-Programming-Language:master","ref":"master","sha":"f830db2b487500d0d5fc736cb3f044e70c7cc2d1","user":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"D-Programming-Language/phobos","owner":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/D-Programming-Language/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/D-Programming-Language/phobos","forks_url":"https://api.github.com/repos/D-Programming-Language/phobos/forks","keys_url":"https://api.github.com/repos/D-Programming-Language/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/D-Programming-Language/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/D-Programming-Language/phobos/teams","hooks_url":"https://api.github.com/repos/D-Programming-Language/phobos/hooks","issue_events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/events","assignees_url":"https://api.github.com/repos/D-Programming-Language/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/D-Programming-Language/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/tags","blobs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/D-Programming-Language/phobos/languages","stargazers_url":"https://api.github.com/repos/D-Programming-Language/phobos/stargazers","contributors_url":"https://api.github.com/repos/D-Programming-Language/phobos/contributors","subscribers_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscribers","subscription_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscription","commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/D-Programming-Language/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/D-Programming-Language/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/D-Programming-Language/phobos/merges","archive_url":"https://api.github.com/repos/D-Programming-Language/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/D-Programming-Language/phobos/downloads","issues_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/D-Programming-Language/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/D-Programming-Language/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/labels{/name}","releases_url":"https://api.github.com/repos/D-Programming-Language/phobos/releases{/id}","created_at":"2011-01-15T07:00:06Z","updated_at":"2015-06-17T14:55:53Z","pushed_at":"2015-06-17T12:06:50Z","git_url":"git://github.com/D-Programming-Language/phobos.git","ssh_url":"git@github.com:D-Programming-Language/phobos.git","clone_url":"https://github.com/D-Programming-Language/phobos.git","svn_url":"https://github.com/D-Programming-Language/phobos","homepage":"dlang.org/phobos","size":85803,"stargazers_count":609,"watchers_count":609,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":408,"mirror_url":null,"open_issues_count":84,"forks":408,"open_issues":84,"watchers":609,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/3417"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3417"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3417/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417/comments"},"review_comment":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3417/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/e1b6c4f84f7dc38cd1d83443d640efa0bb6d8cae"}}}}