{"action":"created","issue":{"url":"https://api.github.com/repos/xlab/c-for-go/issues/30","repository_url":"https://api.github.com/repos/xlab/c-for-go","labels_url":"https://api.github.com/repos/xlab/c-for-go/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/xlab/c-for-go/issues/30/comments","events_url":"https://api.github.com/repos/xlab/c-for-go/issues/30/events","html_url":"https://github.com/xlab/c-for-go/pull/30","id":223232918,"number":30,"title":"Pass function pointer instead of &parameter","user":{"login":"pwaller","id":438648,"avatar_url":"https://avatars3.githubusercontent.com/u/438648?v=3","gravatar_id":"","url":"https://api.github.com/users/pwaller","html_url":"https://github.com/pwaller","followers_url":"https://api.github.com/users/pwaller/followers","following_url":"https://api.github.com/users/pwaller/following{/other_user}","gists_url":"https://api.github.com/users/pwaller/gists{/gist_id}","starred_url":"https://api.github.com/users/pwaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwaller/subscriptions","organizations_url":"https://api.github.com/users/pwaller/orgs","repos_url":"https://api.github.com/users/pwaller/repos","events_url":"https://api.github.com/users/pwaller/events{/privacy}","received_events_url":"https://api.github.com/users/pwaller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-20T23:41:12Z","updated_at":"2017-04-30T20:54:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/xlab/c-for-go/pulls/30","html_url":"https://github.com/xlab/c-for-go/pull/30","diff_url":"https://github.com/xlab/c-for-go/pull/30.diff","patch_url":"https://github.com/xlab/c-for-go/pull/30.patch"},"body":"Before this commit, a pointer to the stack was passed as the function\npointer. If you passed `nil` as a function pointer, for example, a\npointer to the stack was being passed.\n\nThis fix is not thorough and I don't actually want to call a CB, so I\nhave not checked that it works for that use case. I have not dived in to\ndiscover if there is a better way to make this work, I could use a hand\nhere improving this fix.\n\nI note that there exists a function pointer type (`CB` below), which has\na `PassRef`/`PassValue` methods. Maybe those should be called?\n\nBefore:\n\n```\nfunc F(cb CB) {\n\tcb, _ := (*[0]byte)(unsafe.Pointer(&cb)), cgoAllocsUnknown\n\tC.cfunc(cb)\n}\n```\n\nAfter:\n\n```\nfunc F(cb CB) {\n\tcb, _ := *(**[0]byte)(unsafe.Pointer(&cb)), cgoAllocsUnknown\n\tC.cfunc(cb)\n}\n```"},"comment":{"url":"https://api.github.com/repos/xlab/c-for-go/issues/comments/298256452","html_url":"https://github.com/xlab/c-for-go/pull/30#issuecomment-298256452","issue_url":"https://api.github.com/repos/xlab/c-for-go/issues/30","id":298256452,"user":{"login":"pwaller","id":438648,"avatar_url":"https://avatars3.githubusercontent.com/u/438648?v=3","gravatar_id":"","url":"https://api.github.com/users/pwaller","html_url":"https://github.com/pwaller","followers_url":"https://api.github.com/users/pwaller/followers","following_url":"https://api.github.com/users/pwaller/following{/other_user}","gists_url":"https://api.github.com/users/pwaller/gists{/gist_id}","starred_url":"https://api.github.com/users/pwaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwaller/subscriptions","organizations_url":"https://api.github.com/users/pwaller/orgs","repos_url":"https://api.github.com/users/pwaller/repos","events_url":"https://api.github.com/users/pwaller/events{/privacy}","received_events_url":"https://api.github.com/users/pwaller/received_events","type":"User","site_admin":false},"created_at":"2017-04-30T20:54:18Z","updated_at":"2017-04-30T20:54:18Z","body":"Ping."}}
{"actor":{"display_login":"pwaller"}}