{"action":"created","comment":{"url":"https://api.github.com/repos/google/upb/pulls/comments/58770300","id":58770300,"diff_hunk":"@@ -38,15 +38,45 @@ static void test_noreftracking() {\n   upb_msgdef_unref(md, &md);\n }\n \n+static char *upb_readfile(const char *filename, size_t *len) {\n+  long size;\n+  char *buf;\n+  FILE *f = fopen(filename, \"rb\");\n+  if(!f) return NULL;\n+  if(fseek(f, 0, SEEK_END) != 0) goto error;\n+  size = ftell(f);\n+  if(size < 0) goto error;\n+  if(fseek(f, 0, SEEK_SET) != 0) goto error;\n+  buf = malloc(size + 1);\n+  if(size && fread(buf, size, 1, f) != 1) goto error;\n+  fclose(f);","path":"tests/test_def.c","position":15,"original_position":15,"commit_id":"e9d79d2441732264e2b990a5b2dc76d13724db07","original_commit_id":"e9d79d2441732264e2b990a5b2dc76d13724db07","user":{"login":"scwhittle","id":4431052,"avatar_url":"https://avatars.githubusercontent.com/u/4431052?v=3","gravatar_id":"","url":"https://api.github.com/users/scwhittle","html_url":"https://github.com/scwhittle","followers_url":"https://api.github.com/users/scwhittle/followers","following_url":"https://api.github.com/users/scwhittle/following{/other_user}","gists_url":"https://api.github.com/users/scwhittle/gists{/gist_id}","starred_url":"https://api.github.com/users/scwhittle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scwhittle/subscriptions","organizations_url":"https://api.github.com/users/scwhittle/orgs","repos_url":"https://api.github.com/users/scwhittle/repos","events_url":"https://api.github.com/users/scwhittle/events{/privacy}","received_events_url":"https://api.github.com/users/scwhittle/received_events","type":"User","site_admin":false},"body":"ditto, better yet can you share this utility function instead of reimplementing?","created_at":"2016-04-06T19:52:19Z","updated_at":"2016-04-06T19:52:19Z","html_url":"https://github.com/google/upb/pull/53#discussion_r58770300","pull_request_url":"https://api.github.com/repos/google/upb/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/google/upb/pulls/comments/58770300"},"html":{"href":"https://github.com/google/upb/pull/53#discussion_r58770300"},"pull_request":{"href":"https://api.github.com/repos/google/upb/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/google/upb/pulls/53","id":65380816,"html_url":"https://github.com/google/upb/pull/53","diff_url":"https://github.com/google/upb/pull/53.diff","patch_url":"https://github.com/google/upb/pull/53.patch","issue_url":"https://api.github.com/repos/google/upb/issues/53","number":53,"state":"open","locked":false,"title":"Added upb::FileDef, which represents the file defs are declared in.","user":{"login":"haberman","id":1270,"avatar_url":"https://avatars.githubusercontent.com/u/1270?v=3","gravatar_id":"","url":"https://api.github.com/users/haberman","html_url":"https://github.com/haberman","followers_url":"https://api.github.com/users/haberman/followers","following_url":"https://api.github.com/users/haberman/following{/other_user}","gists_url":"https://api.github.com/users/haberman/gists{/gist_id}","starred_url":"https://api.github.com/users/haberman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haberman/subscriptions","organizations_url":"https://api.github.com/users/haberman/orgs","repos_url":"https://api.github.com/users/haberman/repos","events_url":"https://api.github.com/users/haberman/events{/privacy}","received_events_url":"https://api.github.com/users/haberman/received_events","type":"User","site_admin":false},"body":"It is entirely optional: MessageDef/EnumDef can still exist\r\non their own.  But this can represent a def's file when it is\r\ndesirable to do so (eg. for code generators).\r\n\r\nThis approach will require that we change the way we handle\r\nextensions.  But I think it will be a good change overall.\r\n\r\nSpecifically, we previously handled extensions by duplicating\r\nthe extended message and then adding the extension as a regular\r\nfield to the duplicated message.  This required also duplicating\r\nany messages that could reach the extended message.\r\n\r\nIn the new world we will need a way of declaring and looking up\r\nextensions separately from the message being extended.\r\n\r\nThis change also involves some notable changes to the generated\r\ncode:\r\n\r\n- files are now called foo.upbdefs.h instead of foo.upb.h.\r\n  This reflects the fact that we might possibly generate several\r\n  different output files for a .proto file, and this one is just\r\n  for defs.\r\n\r\n- we no longer generate selectors in the .h file.\r\n\r\n- the upbdefs.c no longer vends a SymbolTable.  Now it vends the\r\n  individual messages (and possibly a FileDef later).  I think this\r\n  will compose better once we can generate files where one\r\n  generated files imports another.\r\n\r\nWe also make the descriptor reader vend a list of FileDefs now.\r\nThis is the best conceptual match for parsing a FileDescriptorSet.","created_at":"2016-04-05T22:19:00Z","updated_at":"2016-04-06T19:52:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9ea24802a3b3c6a59ee18afa873135dcc04af37","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/upb/pulls/53/commits","review_comments_url":"https://api.github.com/repos/google/upb/pulls/53/comments","review_comment_url":"https://api.github.com/repos/google/upb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/upb/issues/53/comments","statuses_url":"https://api.github.com/repos/google/upb/statuses/e9d79d2441732264e2b990a5b2dc76d13724db07","head":{"label":"haberman:filedef","ref":"filedef","sha":"e9d79d2441732264e2b990a5b2dc76d13724db07","user":{"login":"haberman","id":1270,"avatar_url":"https://avatars.githubusercontent.com/u/1270?v=3","gravatar_id":"","url":"https://api.github.com/users/haberman","html_url":"https://github.com/haberman","followers_url":"https://api.github.com/users/haberman/followers","following_url":"https://api.github.com/users/haberman/following{/other_user}","gists_url":"https://api.github.com/users/haberman/gists{/gist_id}","starred_url":"https://api.github.com/users/haberman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haberman/subscriptions","organizations_url":"https://api.github.com/users/haberman/orgs","repos_url":"https://api.github.com/users/haberman/repos","events_url":"https://api.github.com/users/haberman/events{/privacy}","received_events_url":"https://api.github.com/users/haberman/received_events","type":"User","site_admin":false},"repo":{"id":35840835,"name":"upb","full_name":"haberman/upb","owner":{"login":"haberman","id":1270,"avatar_url":"https://avatars.githubusercontent.com/u/1270?v=3","gravatar_id":"","url":"https://api.github.com/users/haberman","html_url":"https://github.com/haberman","followers_url":"https://api.github.com/users/haberman/followers","following_url":"https://api.github.com/users/haberman/following{/other_user}","gists_url":"https://api.github.com/users/haberman/gists{/gist_id}","starred_url":"https://api.github.com/users/haberman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haberman/subscriptions","organizations_url":"https://api.github.com/users/haberman/orgs","repos_url":"https://api.github.com/users/haberman/repos","events_url":"https://api.github.com/users/haberman/events{/privacy}","received_events_url":"https://api.github.com/users/haberman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haberman/upb","description":"small, fast parsers for the 21st century","fork":true,"url":"https://api.github.com/repos/haberman/upb","forks_url":"https://api.github.com/repos/haberman/upb/forks","keys_url":"https://api.github.com/repos/haberman/upb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haberman/upb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haberman/upb/teams","hooks_url":"https://api.github.com/repos/haberman/upb/hooks","issue_events_url":"https://api.github.com/repos/haberman/upb/issues/events{/number}","events_url":"https://api.github.com/repos/haberman/upb/events","assignees_url":"https://api.github.com/repos/haberman/upb/assignees{/user}","branches_url":"https://api.github.com/repos/haberman/upb/branches{/branch}","tags_url":"https://api.github.com/repos/haberman/upb/tags","blobs_url":"https://api.github.com/repos/haberman/upb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haberman/upb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haberman/upb/git/refs{/sha}","trees_url":"https://api.github.com/repos/haberman/upb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haberman/upb/statuses/{sha}","languages_url":"https://api.github.com/repos/haberman/upb/languages","stargazers_url":"https://api.github.com/repos/haberman/upb/stargazers","contributors_url":"https://api.github.com/repos/haberman/upb/contributors","subscribers_url":"https://api.github.com/repos/haberman/upb/subscribers","subscription_url":"https://api.github.com/repos/haberman/upb/subscription","commits_url":"https://api.github.com/repos/haberman/upb/commits{/sha}","git_commits_url":"https://api.github.com/repos/haberman/upb/git/commits{/sha}","comments_url":"https://api.github.com/repos/haberman/upb/comments{/number}","issue_comment_url":"https://api.github.com/repos/haberman/upb/issues/comments{/number}","contents_url":"https://api.github.com/repos/haberman/upb/contents/{+path}","compare_url":"https://api.github.com/repos/haberman/upb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haberman/upb/merges","archive_url":"https://api.github.com/repos/haberman/upb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haberman/upb/downloads","issues_url":"https://api.github.com/repos/haberman/upb/issues{/number}","pulls_url":"https://api.github.com/repos/haberman/upb/pulls{/number}","milestones_url":"https://api.github.com/repos/haberman/upb/milestones{/number}","notifications_url":"https://api.github.com/repos/haberman/upb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haberman/upb/labels{/name}","releases_url":"https://api.github.com/repos/haberman/upb/releases{/id}","deployments_url":"https://api.github.com/repos/haberman/upb/deployments","created_at":"2015-05-18T20:29:27Z","updated_at":"2016-03-20T11:20:12Z","pushed_at":"2016-04-06T00:52:27Z","git_url":"git://github.com/haberman/upb.git","ssh_url":"git@github.com:haberman/upb.git","clone_url":"https://github.com/haberman/upb.git","svn_url":"https://github.com/haberman/upb","homepage":"https://github.com/haberman/upb/wiki","size":5167,"stargazers_count":24,"watchers_count":24,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":0,"forks":5,"open_issues":0,"watchers":24,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"d0b9d0a9b782e46a483d4d72515f9ab4f72e402a","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":196334,"name":"upb","full_name":"google/upb","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/upb","description":"small, fast parsers for the 21st century","fork":false,"url":"https://api.github.com/repos/google/upb","forks_url":"https://api.github.com/repos/google/upb/forks","keys_url":"https://api.github.com/repos/google/upb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/upb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/upb/teams","hooks_url":"https://api.github.com/repos/google/upb/hooks","issue_events_url":"https://api.github.com/repos/google/upb/issues/events{/number}","events_url":"https://api.github.com/repos/google/upb/events","assignees_url":"https://api.github.com/repos/google/upb/assignees{/user}","branches_url":"https://api.github.com/repos/google/upb/branches{/branch}","tags_url":"https://api.github.com/repos/google/upb/tags","blobs_url":"https://api.github.com/repos/google/upb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/upb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/upb/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/upb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/upb/statuses/{sha}","languages_url":"https://api.github.com/repos/google/upb/languages","stargazers_url":"https://api.github.com/repos/google/upb/stargazers","contributors_url":"https://api.github.com/repos/google/upb/contributors","subscribers_url":"https://api.github.com/repos/google/upb/subscribers","subscription_url":"https://api.github.com/repos/google/upb/subscription","commits_url":"https://api.github.com/repos/google/upb/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/upb/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/upb/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/upb/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/upb/contents/{+path}","compare_url":"https://api.github.com/repos/google/upb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/upb/merges","archive_url":"https://api.github.com/repos/google/upb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/upb/downloads","issues_url":"https://api.github.com/repos/google/upb/issues{/number}","pulls_url":"https://api.github.com/repos/google/upb/pulls{/number}","milestones_url":"https://api.github.com/repos/google/upb/milestones{/number}","notifications_url":"https://api.github.com/repos/google/upb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/upb/labels{/name}","releases_url":"https://api.github.com/repos/google/upb/releases{/id}","deployments_url":"https://api.github.com/repos/google/upb/deployments","created_at":"2009-05-09T02:38:42Z","updated_at":"2016-04-04T18:08:06Z","pushed_at":"2016-04-06T00:52:27Z","git_url":"git://github.com/google/upb.git","ssh_url":"git@github.com:google/upb.git","clone_url":"https://github.com/google/upb.git","svn_url":"https://github.com/google/upb","homepage":"https://github.com/haberman/upb/wiki","size":4925,"stargazers_count":643,"watchers_count":643,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":77,"mirror_url":null,"open_issues_count":11,"forks":77,"open_issues":11,"watchers":643,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/upb/pulls/53"},"html":{"href":"https://github.com/google/upb/pull/53"},"issue":{"href":"https://api.github.com/repos/google/upb/issues/53"},"comments":{"href":"https://api.github.com/repos/google/upb/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/google/upb/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/google/upb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/upb/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/google/upb/statuses/e9d79d2441732264e2b990a5b2dc76d13724db07"}}}}