{"action":"closed","number":870,"pull_request":{"url":"https://api.github.com/repos/universal-ctags/ctags/pulls/870","id":65442832,"html_url":"https://github.com/universal-ctags/ctags/pull/870","diff_url":"https://github.com/universal-ctags/ctags/pull/870.diff","patch_url":"https://github.com/universal-ctags/ctags/pull/870.patch","issue_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870","number":870,"state":"closed","locked":false,"title":"Add the MIO library","user":{"login":"techee","id":713965,"avatar_url":"https://avatars.githubusercontent.com/u/713965?v=3","gravatar_id":"","url":"https://api.github.com/users/techee","html_url":"https://github.com/techee","followers_url":"https://api.github.com/users/techee/followers","following_url":"https://api.github.com/users/techee/following{/other_user}","gists_url":"https://api.github.com/users/techee/gists{/gist_id}","starred_url":"https://api.github.com/users/techee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techee/subscriptions","organizations_url":"https://api.github.com/users/techee/orgs","repos_url":"https://api.github.com/users/techee/repos","events_url":"https://api.github.com/users/techee/events{/privacy}","received_events_url":"https://api.github.com/users/techee/received_events","type":"User","site_admin":false},"body":"As discussed here #863  this pull request introduces the MIO library to be able to parse memory buffers similarly to files which is both slightly faster and useful for users using ctags as a library.\r\n\r\nThe patch is mostly trivial - I just added the mio.c/h files, added MIO instead of FILE to inputFile and the rest is just following and fixing the errors from the compiler (in addition I made a manual check of all FILE, fpos_t, etc. afterwards and converted a few extra cases). There are still a few FILE left - these are mostly in cases where e.g. printing to stdout or in pcoproc.c/h where MIO doesn't make much sense.\r\n\r\nI kept the original variable names (which in the case of FILE was in most cases fp) - in Geany they were renamed to mio - I don't know if it's worth the rename to mio, fp is probably fine in this case.\r\n\r\nFinally, for files smaller than 1MB I loaded them into memory before parsing and let the parser parse them from memory - it's slightly faster. Tested on linux kernel sources ctags -R . took 40s instead of 44s on my machine.\r\n\r\nIt would be useful if someone with MS Visual Studio could verify this still compiles and works on Windows.\r\n\r\n@b4n I did the stuff I suggested in #863 - I hope I didn't screw up your library too much. What I did:\r\n\r\n* replaced the glib types with ordinary C types\r\n* removed the \"virtual\" calls and replaced them with simple if/else\r\n* made the implementation in a single file\r\n* reformatted the library to more or less match universal-ctags style\r\n* removed the MIO_FORCE_ANSI ifdef as it included some glib file and we don't really need it\r\n* added mio_flush() - of course makes sense just for the file backend (calls fflush())\r\n* made mio_free() return error code from fclose()\r\n* changed mio_new_fp() to return NULL when the passed FILE is NULL (simplifies logic at one place in ctags and makes sense IMO)\r\n\r\nAre you fine with the changes I made?","created_at":"2016-04-06T10:26:53Z","updated_at":"2016-04-08T14:32:11Z","closed_at":"2016-04-08T14:32:11Z","merged_at":"2016-04-08T14:32:11Z","merge_commit_sha":"9de85ed088b0de8b1a8d23490a53e623b5e15d71","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/universal-ctags/ctags/pulls/870/commits","review_comments_url":"https://api.github.com/repos/universal-ctags/ctags/pulls/870/comments","review_comment_url":"https://api.github.com/repos/universal-ctags/ctags/pulls/comments{/number}","comments_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870/comments","statuses_url":"https://api.github.com/repos/universal-ctags/ctags/statuses/2db30dfe5a3995a5c42b1ecc9568070ecc742373","head":{"label":"techee:mio","ref":"mio","sha":"2db30dfe5a3995a5c42b1ecc9568070ecc742373","user":{"login":"techee","id":713965,"avatar_url":"https://avatars.githubusercontent.com/u/713965?v=3","gravatar_id":"","url":"https://api.github.com/users/techee","html_url":"https://github.com/techee","followers_url":"https://api.github.com/users/techee/followers","following_url":"https://api.github.com/users/techee/following{/other_user}","gists_url":"https://api.github.com/users/techee/gists{/gist_id}","starred_url":"https://api.github.com/users/techee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techee/subscriptions","organizations_url":"https://api.github.com/users/techee/orgs","repos_url":"https://api.github.com/users/techee/repos","events_url":"https://api.github.com/users/techee/events{/privacy}","received_events_url":"https://api.github.com/users/techee/received_events","type":"User","site_admin":false},"repo":{"id":27652831,"name":"ctags","full_name":"techee/ctags","owner":{"login":"techee","id":713965,"avatar_url":"https://avatars.githubusercontent.com/u/713965?v=3","gravatar_id":"","url":"https://api.github.com/users/techee","html_url":"https://github.com/techee","followers_url":"https://api.github.com/users/techee/followers","following_url":"https://api.github.com/users/techee/following{/other_user}","gists_url":"https://api.github.com/users/techee/gists{/gist_id}","starred_url":"https://api.github.com/users/techee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techee/subscriptions","organizations_url":"https://api.github.com/users/techee/orgs","repos_url":"https://api.github.com/users/techee/repos","events_url":"https://api.github.com/users/techee/events{/privacy}","received_events_url":"https://api.github.com/users/techee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/techee/ctags","description":"clone of official ctags repo with obj-c and css patches added","fork":true,"url":"https://api.github.com/repos/techee/ctags","forks_url":"https://api.github.com/repos/techee/ctags/forks","keys_url":"https://api.github.com/repos/techee/ctags/keys{/key_id}","collaborators_url":"https://api.github.com/repos/techee/ctags/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/techee/ctags/teams","hooks_url":"https://api.github.com/repos/techee/ctags/hooks","issue_events_url":"https://api.github.com/repos/techee/ctags/issues/events{/number}","events_url":"https://api.github.com/repos/techee/ctags/events","assignees_url":"https://api.github.com/repos/techee/ctags/assignees{/user}","branches_url":"https://api.github.com/repos/techee/ctags/branches{/branch}","tags_url":"https://api.github.com/repos/techee/ctags/tags","blobs_url":"https://api.github.com/repos/techee/ctags/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/techee/ctags/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/techee/ctags/git/refs{/sha}","trees_url":"https://api.github.com/repos/techee/ctags/git/trees{/sha}","statuses_url":"https://api.github.com/repos/techee/ctags/statuses/{sha}","languages_url":"https://api.github.com/repos/techee/ctags/languages","stargazers_url":"https://api.github.com/repos/techee/ctags/stargazers","contributors_url":"https://api.github.com/repos/techee/ctags/contributors","subscribers_url":"https://api.github.com/repos/techee/ctags/subscribers","subscription_url":"https://api.github.com/repos/techee/ctags/subscription","commits_url":"https://api.github.com/repos/techee/ctags/commits{/sha}","git_commits_url":"https://api.github.com/repos/techee/ctags/git/commits{/sha}","comments_url":"https://api.github.com/repos/techee/ctags/comments{/number}","issue_comment_url":"https://api.github.com/repos/techee/ctags/issues/comments{/number}","contents_url":"https://api.github.com/repos/techee/ctags/contents/{+path}","compare_url":"https://api.github.com/repos/techee/ctags/compare/{base}...{head}","merges_url":"https://api.github.com/repos/techee/ctags/merges","archive_url":"https://api.github.com/repos/techee/ctags/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/techee/ctags/downloads","issues_url":"https://api.github.com/repos/techee/ctags/issues{/number}","pulls_url":"https://api.github.com/repos/techee/ctags/pulls{/number}","milestones_url":"https://api.github.com/repos/techee/ctags/milestones{/number}","notifications_url":"https://api.github.com/repos/techee/ctags/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/techee/ctags/labels{/name}","releases_url":"https://api.github.com/repos/techee/ctags/releases{/id}","deployments_url":"https://api.github.com/repos/techee/ctags/deployments","created_at":"2014-12-06T23:29:21Z","updated_at":"2014-12-06T23:29:24Z","pushed_at":"2016-04-07T09:15:11Z","git_url":"git://github.com/techee/ctags.git","ssh_url":"git@github.com:techee/ctags.git","clone_url":"https://github.com/techee/ctags.git","svn_url":"https://github.com/techee/ctags","homepage":"","size":6890,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"universal-ctags:master","ref":"master","sha":"5b8a9ed1ced08fd5457cd4e47daeece17e0e146a","user":{"login":"universal-ctags","id":9616766,"avatar_url":"https://avatars.githubusercontent.com/u/9616766?v=3","gravatar_id":"","url":"https://api.github.com/users/universal-ctags","html_url":"https://github.com/universal-ctags","followers_url":"https://api.github.com/users/universal-ctags/followers","following_url":"https://api.github.com/users/universal-ctags/following{/other_user}","gists_url":"https://api.github.com/users/universal-ctags/gists{/gist_id}","starred_url":"https://api.github.com/users/universal-ctags/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universal-ctags/subscriptions","organizations_url":"https://api.github.com/users/universal-ctags/orgs","repos_url":"https://api.github.com/users/universal-ctags/repos","events_url":"https://api.github.com/users/universal-ctags/events{/privacy}","received_events_url":"https://api.github.com/users/universal-ctags/received_events","type":"Organization","site_admin":false},"repo":{"id":578839,"name":"ctags","full_name":"universal-ctags/ctags","owner":{"login":"universal-ctags","id":9616766,"avatar_url":"https://avatars.githubusercontent.com/u/9616766?v=3","gravatar_id":"","url":"https://api.github.com/users/universal-ctags","html_url":"https://github.com/universal-ctags","followers_url":"https://api.github.com/users/universal-ctags/followers","following_url":"https://api.github.com/users/universal-ctags/following{/other_user}","gists_url":"https://api.github.com/users/universal-ctags/gists{/gist_id}","starred_url":"https://api.github.com/users/universal-ctags/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/universal-ctags/subscriptions","organizations_url":"https://api.github.com/users/universal-ctags/orgs","repos_url":"https://api.github.com/users/universal-ctags/repos","events_url":"https://api.github.com/users/universal-ctags/events{/privacy}","received_events_url":"https://api.github.com/users/universal-ctags/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/universal-ctags/ctags","description":"A maintained ctags implementation","fork":false,"url":"https://api.github.com/repos/universal-ctags/ctags","forks_url":"https://api.github.com/repos/universal-ctags/ctags/forks","keys_url":"https://api.github.com/repos/universal-ctags/ctags/keys{/key_id}","collaborators_url":"https://api.github.com/repos/universal-ctags/ctags/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/universal-ctags/ctags/teams","hooks_url":"https://api.github.com/repos/universal-ctags/ctags/hooks","issue_events_url":"https://api.github.com/repos/universal-ctags/ctags/issues/events{/number}","events_url":"https://api.github.com/repos/universal-ctags/ctags/events","assignees_url":"https://api.github.com/repos/universal-ctags/ctags/assignees{/user}","branches_url":"https://api.github.com/repos/universal-ctags/ctags/branches{/branch}","tags_url":"https://api.github.com/repos/universal-ctags/ctags/tags","blobs_url":"https://api.github.com/repos/universal-ctags/ctags/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/universal-ctags/ctags/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/universal-ctags/ctags/git/refs{/sha}","trees_url":"https://api.github.com/repos/universal-ctags/ctags/git/trees{/sha}","statuses_url":"https://api.github.com/repos/universal-ctags/ctags/statuses/{sha}","languages_url":"https://api.github.com/repos/universal-ctags/ctags/languages","stargazers_url":"https://api.github.com/repos/universal-ctags/ctags/stargazers","contributors_url":"https://api.github.com/repos/universal-ctags/ctags/contributors","subscribers_url":"https://api.github.com/repos/universal-ctags/ctags/subscribers","subscription_url":"https://api.github.com/repos/universal-ctags/ctags/subscription","commits_url":"https://api.github.com/repos/universal-ctags/ctags/commits{/sha}","git_commits_url":"https://api.github.com/repos/universal-ctags/ctags/git/commits{/sha}","comments_url":"https://api.github.com/repos/universal-ctags/ctags/comments{/number}","issue_comment_url":"https://api.github.com/repos/universal-ctags/ctags/issues/comments{/number}","contents_url":"https://api.github.com/repos/universal-ctags/ctags/contents/{+path}","compare_url":"https://api.github.com/repos/universal-ctags/ctags/compare/{base}...{head}","merges_url":"https://api.github.com/repos/universal-ctags/ctags/merges","archive_url":"https://api.github.com/repos/universal-ctags/ctags/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/universal-ctags/ctags/downloads","issues_url":"https://api.github.com/repos/universal-ctags/ctags/issues{/number}","pulls_url":"https://api.github.com/repos/universal-ctags/ctags/pulls{/number}","milestones_url":"https://api.github.com/repos/universal-ctags/ctags/milestones{/number}","notifications_url":"https://api.github.com/repos/universal-ctags/ctags/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/universal-ctags/ctags/labels{/name}","releases_url":"https://api.github.com/repos/universal-ctags/ctags/releases{/id}","deployments_url":"https://api.github.com/repos/universal-ctags/ctags/deployments","created_at":"2010-03-25T10:43:13Z","updated_at":"2016-04-07T18:40:30Z","pushed_at":"2016-04-08T14:32:11Z","git_url":"git://github.com/universal-ctags/ctags.git","ssh_url":"git@github.com:universal-ctags/ctags.git","clone_url":"https://github.com/universal-ctags/ctags.git","svn_url":"https://github.com/universal-ctags/ctags","homepage":"https://ctags.io","size":9069,"stargazers_count":621,"watchers_count":621,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":90,"forks":121,"open_issues":90,"watchers":621,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/universal-ctags/ctags/pulls/870"},"html":{"href":"https://github.com/universal-ctags/ctags/pull/870"},"issue":{"href":"https://api.github.com/repos/universal-ctags/ctags/issues/870"},"comments":{"href":"https://api.github.com/repos/universal-ctags/ctags/issues/870/comments"},"review_comments":{"href":"https://api.github.com/repos/universal-ctags/ctags/pulls/870/comments"},"review_comment":{"href":"https://api.github.com/repos/universal-ctags/ctags/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/universal-ctags/ctags/pulls/870/commits"},"statuses":{"href":"https://api.github.com/repos/universal-ctags/ctags/statuses/2db30dfe5a3995a5c42b1ecc9568070ecc742373"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"masatake","id":77077,"avatar_url":"https://avatars.githubusercontent.com/u/77077?v=3","gravatar_id":"","url":"https://api.github.com/users/masatake","html_url":"https://github.com/masatake","followers_url":"https://api.github.com/users/masatake/followers","following_url":"https://api.github.com/users/masatake/following{/other_user}","gists_url":"https://api.github.com/users/masatake/gists{/gist_id}","starred_url":"https://api.github.com/users/masatake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masatake/subscriptions","organizations_url":"https://api.github.com/users/masatake/orgs","repos_url":"https://api.github.com/users/masatake/repos","events_url":"https://api.github.com/users/masatake/events{/privacy}","received_events_url":"https://api.github.com/users/masatake/received_events","type":"User","site_admin":false},"comments":8,"review_comments":0,"commits":7,"additions":1533,"deletions":268,"changed_files":43}}