{"action":"created","issue":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/870","repository_url":"https://api.github.com/repos/universal-ctags/ctags","labels_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870/labels{/name}","comments_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870/comments","events_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870/events","html_url":"https://github.com/universal-ctags/ctags/pull/870","id":146267069,"number":870,"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-06T10:26:53Z","updated_at":"2016-04-06T11:14:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/universal-ctags/ctags/pulls/870","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"},"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?"},"comment":{"url":"https://api.github.com/repos/universal-ctags/ctags/issues/comments/206315748","html_url":"https://github.com/universal-ctags/ctags/pull/870#issuecomment-206315748","issue_url":"https://api.github.com/repos/universal-ctags/ctags/issues/870","id":206315748,"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},"created_at":"2016-04-06T11:14:05Z","updated_at":"2016-04-06T11:14:05Z","body":"OK, just checked the travis fails - locally I tried just \"make check\" which worked fine but it seems the travis-check.sh script does something different. Will investigate."}}