{"action":"created","issue":{"url":"https://api.github.com/repos/lh3/minimap2/issues/177","repository_url":"https://api.github.com/repos/lh3/minimap2","labels_url":"https://api.github.com/repos/lh3/minimap2/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/lh3/minimap2/issues/177/comments","events_url":"https://api.github.com/repos/lh3/minimap2/issues/177/events","html_url":"https://github.com/lh3/minimap2/pull/177","id":329927057,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMDU5MTg4","number":177,"title":"Expose index i/o functions in public API","user":{"login":"ilya-kolpakov","id":592849,"node_id":"MDQ6VXNlcjU5Mjg0OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/592849?v=4","gravatar_id":"","url":"https://api.github.com/users/ilya-kolpakov","html_url":"https://github.com/ilya-kolpakov","followers_url":"https://api.github.com/users/ilya-kolpakov/followers","following_url":"https://api.github.com/users/ilya-kolpakov/following{/other_user}","gists_url":"https://api.github.com/users/ilya-kolpakov/gists{/gist_id}","starred_url":"https://api.github.com/users/ilya-kolpakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilya-kolpakov/subscriptions","organizations_url":"https://api.github.com/users/ilya-kolpakov/orgs","repos_url":"https://api.github.com/users/ilya-kolpakov/repos","events_url":"https://api.github.com/users/ilya-kolpakov/events{/privacy}","received_events_url":"https://api.github.com/users/ilya-kolpakov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-06T15:46:34Z","updated_at":"2018-06-06T19:22:14Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/lh3/minimap2/pulls/177","html_url":"https://github.com/lh3/minimap2/pull/177","diff_url":"https://github.com/lh3/minimap2/pull/177.diff","patch_url":"https://github.com/lh3/minimap2/pull/177.patch"},"body":"### Overview\r\n- This PR puts signatures `mm_idx_load()`, `mm_idx_dump()` and `mm_idx_is_idx()` in `minimap.h`\r\n- The first commit prevents calling `strlen()` on null reference names in `mm_idx_dump`.\r\n\r\n### Rationale\r\nI am using `minimap2` from C++ and need explicit API for storing and loading an already created index. \r\n - Saving via the public API is currently impossible since `mm_idx_dump` is not exposed\r\n - For loading one can get by with `mm_idx_reader_read` but I do not see a downside of exposing `mm_idx_load` which indicates intent much more clearly.\r\n - The detection function `mm_idx_is_idx` is also nice to have for anyone using minimap2 as a library\r\n\r\n### Testing\r\nSaving and loading works as expected with small testing references as well as hg19"},"comment":{"url":"https://api.github.com/repos/lh3/minimap2/issues/comments/395184228","html_url":"https://github.com/lh3/minimap2/pull/177#issuecomment-395184228","issue_url":"https://api.github.com/repos/lh3/minimap2/issues/177","id":395184228,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTE4NDIyOA==","user":{"login":"ilya-kolpakov","id":592849,"node_id":"MDQ6VXNlcjU5Mjg0OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/592849?v=4","gravatar_id":"","url":"https://api.github.com/users/ilya-kolpakov","html_url":"https://github.com/ilya-kolpakov","followers_url":"https://api.github.com/users/ilya-kolpakov/followers","following_url":"https://api.github.com/users/ilya-kolpakov/following{/other_user}","gists_url":"https://api.github.com/users/ilya-kolpakov/gists{/gist_id}","starred_url":"https://api.github.com/users/ilya-kolpakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilya-kolpakov/subscriptions","organizations_url":"https://api.github.com/users/ilya-kolpakov/orgs","repos_url":"https://api.github.com/users/ilya-kolpakov/repos","events_url":"https://api.github.com/users/ilya-kolpakov/events{/privacy}","received_events_url":"https://api.github.com/users/ilya-kolpakov/received_events","type":"User","site_admin":false},"created_at":"2018-06-06T19:22:13Z","updated_at":"2018-06-06T19:22:13Z","author_association":"NONE","body":"Thanks for the feedback.\n\nI think it’s fine to call ‘fwrite’ with zero third argument and the null\npointer as the first. It shouldn’t dereference the pointer as no actual\nwriting takes place.\n\nhttp://pubs.opengroup.org/onlinepubs/009695399/functions/fwrite.html\n\nIt seems to work fine on at least two different Linuxes (old Centos and\nbleeding edge NixOS). My code creates an index with references having no\nnames and that’s exactly why the ‘strlen’ there is a problem.\n\nIf there’s some evidence that passing null pointer to ‘fwrite’ is\nundesirable even with zero items I can change it no problem.\n\nOn Wed, 6 Jun 2018 at 18:33, John Marshall <notifications@github.com> wrote:\n\n> Re the first commit: if the reference name really can be NULL, then\n> fwriting it has the same problem (even though l is 0). Could be fixed with\n>\n> if (l > 0) fwrite(mi->seq[i].name, 1, l, fp);\n>\n> or more clearly by having an if-else around both the name-related fwrites.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/lh3/minimap2/pull/177#issuecomment-395132784>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/AAkL0aOf5EI6q5x7jEHlkMGIisirRg4Kks5t6ARdgaJpZM4Uc56T>\n> .\n>\n-- \nSent from Gmail Mobile\n"}}
{"actor":{"display_login":"ilya-kolpakov"}}