{"action":"created","comment":{"url":"https://api.github.com/repos/itheof/42sh-posix/pulls/comments/82661921","pull_request_review_id":3554151,"id":82661921,"diff_hunk":"@@ -0,0 +1,104 @@\n+#include <stdlib.h>\n+#include <stdbool.h>\n+#include \"history.h\"\n+#include \"cbuffer_42.h\"\n+#include \"string_42.h\"\n+\n+extern t_history\tg_history;\n+\n+bool\t\thistory_find(t_result *ret, const char *patt)\n+{\n+\tconst char\t*command;\n+\tconst char\t*match;\n+\tsize_t\t\ti;\n+\n+\ti = g_history.last_id;\n+\twhile (i > g_history.last_id - g_history.cbuffer.len)\n+\t{\n+\t\tcommand = history_get_id(i);\n+\t\tif ((match = ft_strrstr(command, patt)) != NULL)\n+\t\t{\n+\t\t\tif (ret != NULL)\n+\t\t\t{\n+\t\t\t\tret->command_id = i;\n+\t\t\t\tret->offset = (size_t)(match - command);\n+\t\t\t}\n+\t\t\treturn (true);\n+\t\t}\n+\t\t--i;\n+\t}\n+\treturn (false);\n+}\n+\n+static bool\tsearch_command_from(t_result *ret, const char *patt, t_result from)\n+{\n+\tconst char\t*command;\n+\tconst char\t*match;\n+\tsize_t\t\tlen;\n+\n+\tlen = ft_strlen(patt);\n+\tif (from.offset >= len && (command = history_get_id(from.command_id)))\n+\t{\n+\t\tif ((match = ft_strrnstr(command, patt, from.offset - 1)) != NULL)\n+\t\t{\n+\t\t\tret->command_id = from.command_id;","path":"src/history/history_search.c","position":44,"original_position":44,"commit_id":"51625c35e7b6034719cf7c49e804e3be0ce4564c","original_commit_id":"010c43291348ace65050c62eb7af3d0f37259101","user":{"login":"tmielcza","id":13508589,"avatar_url":"https://avatars.githubusercontent.com/u/13508589?v=3","gravatar_id":"","url":"https://api.github.com/users/tmielcza","html_url":"https://github.com/tmielcza","followers_url":"https://api.github.com/users/tmielcza/followers","following_url":"https://api.github.com/users/tmielcza/following{/other_user}","gists_url":"https://api.github.com/users/tmielcza/gists{/gist_id}","starred_url":"https://api.github.com/users/tmielcza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmielcza/subscriptions","organizations_url":"https://api.github.com/users/tmielcza/orgs","repos_url":"https://api.github.com/users/tmielcza/repos","events_url":"https://api.github.com/users/tmielcza/events{/privacy}","received_events_url":"https://api.github.com/users/tmielcza/received_events","type":"User","site_admin":false},"body":"Ne pas oublier de checker `ret`. Ou alors ne pas le verifier dans `history_find`.","created_at":"2016-10-10T18:50:11Z","updated_at":"2016-10-10T18:50:11Z","html_url":"https://github.com/itheof/42sh-posix/pull/21#discussion_r82661921","pull_request_url":"https://api.github.com/repos/itheof/42sh-posix/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/comments/82661921"},"html":{"href":"https://github.com/itheof/42sh-posix/pull/21#discussion_r82661921"},"pull_request":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/itheof/42sh-posix/pulls/21","id":88561049,"html_url":"https://github.com/itheof/42sh-posix/pull/21","diff_url":"https://github.com/itheof/42sh-posix/pull/21.diff","patch_url":"https://github.com/itheof/42sh-posix/pull/21.patch","issue_url":"https://api.github.com/repos/itheof/42sh-posix/issues/21","number":21,"state":"open","locked":false,"title":"New history container","user":{"login":"Kerollmops","id":3610253,"avatar_url":"https://avatars.githubusercontent.com/u/3610253?v=3","gravatar_id":"","url":"https://api.github.com/users/Kerollmops","html_url":"https://github.com/Kerollmops","followers_url":"https://api.github.com/users/Kerollmops/followers","following_url":"https://api.github.com/users/Kerollmops/following{/other_user}","gists_url":"https://api.github.com/users/Kerollmops/gists{/gist_id}","starred_url":"https://api.github.com/users/Kerollmops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kerollmops/subscriptions","organizations_url":"https://api.github.com/users/Kerollmops/orgs","repos_url":"https://api.github.com/users/Kerollmops/repos","events_url":"https://api.github.com/users/Kerollmops/events{/privacy}","received_events_url":"https://api.github.com/users/Kerollmops/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-08T22:25:15Z","updated_at":"2016-10-10T18:50:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"Kerollmops","id":3610253,"avatar_url":"https://avatars.githubusercontent.com/u/3610253?v=3","gravatar_id":"","url":"https://api.github.com/users/Kerollmops","html_url":"https://github.com/Kerollmops","followers_url":"https://api.github.com/users/Kerollmops/followers","following_url":"https://api.github.com/users/Kerollmops/following{/other_user}","gists_url":"https://api.github.com/users/Kerollmops/gists{/gist_id}","starred_url":"https://api.github.com/users/Kerollmops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kerollmops/subscriptions","organizations_url":"https://api.github.com/users/Kerollmops/orgs","repos_url":"https://api.github.com/users/Kerollmops/repos","events_url":"https://api.github.com/users/Kerollmops/events{/privacy}","received_events_url":"https://api.github.com/users/Kerollmops/received_events","type":"User","site_admin":false},"assignees":[{"login":"Kerollmops","id":3610253,"avatar_url":"https://avatars.githubusercontent.com/u/3610253?v=3","gravatar_id":"","url":"https://api.github.com/users/Kerollmops","html_url":"https://github.com/Kerollmops","followers_url":"https://api.github.com/users/Kerollmops/followers","following_url":"https://api.github.com/users/Kerollmops/following{/other_user}","gists_url":"https://api.github.com/users/Kerollmops/gists{/gist_id}","starred_url":"https://api.github.com/users/Kerollmops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kerollmops/subscriptions","organizations_url":"https://api.github.com/users/Kerollmops/orgs","repos_url":"https://api.github.com/users/Kerollmops/repos","events_url":"https://api.github.com/users/Kerollmops/events{/privacy}","received_events_url":"https://api.github.com/users/Kerollmops/received_events","type":"User","site_admin":false},{"login":"Otaekek","id":8776538,"avatar_url":"https://avatars.githubusercontent.com/u/8776538?v=3","gravatar_id":"","url":"https://api.github.com/users/Otaekek","html_url":"https://github.com/Otaekek","followers_url":"https://api.github.com/users/Otaekek/followers","following_url":"https://api.github.com/users/Otaekek/following{/other_user}","gists_url":"https://api.github.com/users/Otaekek/gists{/gist_id}","starred_url":"https://api.github.com/users/Otaekek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Otaekek/subscriptions","organizations_url":"https://api.github.com/users/Otaekek/orgs","repos_url":"https://api.github.com/users/Otaekek/repos","events_url":"https://api.github.com/users/Otaekek/events{/privacy}","received_events_url":"https://api.github.com/users/Otaekek/received_events","type":"User","site_admin":false},{"login":"itheof","id":8781784,"avatar_url":"https://avatars.githubusercontent.com/u/8781784?v=3","gravatar_id":"","url":"https://api.github.com/users/itheof","html_url":"https://github.com/itheof","followers_url":"https://api.github.com/users/itheof/followers","following_url":"https://api.github.com/users/itheof/following{/other_user}","gists_url":"https://api.github.com/users/itheof/gists{/gist_id}","starred_url":"https://api.github.com/users/itheof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itheof/subscriptions","organizations_url":"https://api.github.com/users/itheof/orgs","repos_url":"https://api.github.com/users/itheof/repos","events_url":"https://api.github.com/users/itheof/events{/privacy}","received_events_url":"https://api.github.com/users/itheof/received_events","type":"User","site_admin":false},{"login":"tmielcza","id":13508589,"avatar_url":"https://avatars.githubusercontent.com/u/13508589?v=3","gravatar_id":"","url":"https://api.github.com/users/tmielcza","html_url":"https://github.com/tmielcza","followers_url":"https://api.github.com/users/tmielcza/followers","following_url":"https://api.github.com/users/tmielcza/following{/other_user}","gists_url":"https://api.github.com/users/tmielcza/gists{/gist_id}","starred_url":"https://api.github.com/users/tmielcza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmielcza/subscriptions","organizations_url":"https://api.github.com/users/tmielcza/orgs","repos_url":"https://api.github.com/users/tmielcza/repos","events_url":"https://api.github.com/users/tmielcza/events{/privacy}","received_events_url":"https://api.github.com/users/tmielcza/received_events","type":"User","site_admin":false},{"login":"dkrmr","id":16935834,"avatar_url":"https://avatars.githubusercontent.com/u/16935834?v=3","gravatar_id":"","url":"https://api.github.com/users/dkrmr","html_url":"https://github.com/dkrmr","followers_url":"https://api.github.com/users/dkrmr/followers","following_url":"https://api.github.com/users/dkrmr/following{/other_user}","gists_url":"https://api.github.com/users/dkrmr/gists{/gist_id}","starred_url":"https://api.github.com/users/dkrmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkrmr/subscriptions","organizations_url":"https://api.github.com/users/dkrmr/orgs","repos_url":"https://api.github.com/users/dkrmr/repos","events_url":"https://api.github.com/users/dkrmr/events{/privacy}","received_events_url":"https://api.github.com/users/dkrmr/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/itheof/42sh-posix/pulls/21/commits","review_comments_url":"https://api.github.com/repos/itheof/42sh-posix/pulls/21/comments","review_comment_url":"https://api.github.com/repos/itheof/42sh-posix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/itheof/42sh-posix/issues/21/comments","statuses_url":"https://api.github.com/repos/itheof/42sh-posix/statuses/51625c35e7b6034719cf7c49e804e3be0ce4564c","head":{"label":"itheof:history_search","ref":"history_search","sha":"51625c35e7b6034719cf7c49e804e3be0ce4564c","user":{"login":"itheof","id":8781784,"avatar_url":"https://avatars.githubusercontent.com/u/8781784?v=3","gravatar_id":"","url":"https://api.github.com/users/itheof","html_url":"https://github.com/itheof","followers_url":"https://api.github.com/users/itheof/followers","following_url":"https://api.github.com/users/itheof/following{/other_user}","gists_url":"https://api.github.com/users/itheof/gists{/gist_id}","starred_url":"https://api.github.com/users/itheof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itheof/subscriptions","organizations_url":"https://api.github.com/users/itheof/orgs","repos_url":"https://api.github.com/users/itheof/repos","events_url":"https://api.github.com/users/itheof/events{/privacy}","received_events_url":"https://api.github.com/users/itheof/received_events","type":"User","site_admin":false},"repo":{"id":69264329,"name":"42sh-posix","full_name":"itheof/42sh-posix","owner":{"login":"itheof","id":8781784,"avatar_url":"https://avatars.githubusercontent.com/u/8781784?v=3","gravatar_id":"","url":"https://api.github.com/users/itheof","html_url":"https://github.com/itheof","followers_url":"https://api.github.com/users/itheof/followers","following_url":"https://api.github.com/users/itheof/following{/other_user}","gists_url":"https://api.github.com/users/itheof/gists{/gist_id}","starred_url":"https://api.github.com/users/itheof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itheof/subscriptions","organizations_url":"https://api.github.com/users/itheof/orgs","repos_url":"https://api.github.com/users/itheof/repos","events_url":"https://api.github.com/users/itheof/events{/privacy}","received_events_url":"https://api.github.com/users/itheof/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/itheof/42sh-posix","description":null,"fork":false,"url":"https://api.github.com/repos/itheof/42sh-posix","forks_url":"https://api.github.com/repos/itheof/42sh-posix/forks","keys_url":"https://api.github.com/repos/itheof/42sh-posix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itheof/42sh-posix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itheof/42sh-posix/teams","hooks_url":"https://api.github.com/repos/itheof/42sh-posix/hooks","issue_events_url":"https://api.github.com/repos/itheof/42sh-posix/issues/events{/number}","events_url":"https://api.github.com/repos/itheof/42sh-posix/events","assignees_url":"https://api.github.com/repos/itheof/42sh-posix/assignees{/user}","branches_url":"https://api.github.com/repos/itheof/42sh-posix/branches{/branch}","tags_url":"https://api.github.com/repos/itheof/42sh-posix/tags","blobs_url":"https://api.github.com/repos/itheof/42sh-posix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itheof/42sh-posix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itheof/42sh-posix/git/refs{/sha}","trees_url":"https://api.github.com/repos/itheof/42sh-posix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itheof/42sh-posix/statuses/{sha}","languages_url":"https://api.github.com/repos/itheof/42sh-posix/languages","stargazers_url":"https://api.github.com/repos/itheof/42sh-posix/stargazers","contributors_url":"https://api.github.com/repos/itheof/42sh-posix/contributors","subscribers_url":"https://api.github.com/repos/itheof/42sh-posix/subscribers","subscription_url":"https://api.github.com/repos/itheof/42sh-posix/subscription","commits_url":"https://api.github.com/repos/itheof/42sh-posix/commits{/sha}","git_commits_url":"https://api.github.com/repos/itheof/42sh-posix/git/commits{/sha}","comments_url":"https://api.github.com/repos/itheof/42sh-posix/comments{/number}","issue_comment_url":"https://api.github.com/repos/itheof/42sh-posix/issues/comments{/number}","contents_url":"https://api.github.com/repos/itheof/42sh-posix/contents/{+path}","compare_url":"https://api.github.com/repos/itheof/42sh-posix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itheof/42sh-posix/merges","archive_url":"https://api.github.com/repos/itheof/42sh-posix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itheof/42sh-posix/downloads","issues_url":"https://api.github.com/repos/itheof/42sh-posix/issues{/number}","pulls_url":"https://api.github.com/repos/itheof/42sh-posix/pulls{/number}","milestones_url":"https://api.github.com/repos/itheof/42sh-posix/milestones{/number}","notifications_url":"https://api.github.com/repos/itheof/42sh-posix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itheof/42sh-posix/labels{/name}","releases_url":"https://api.github.com/repos/itheof/42sh-posix/releases{/id}","deployments_url":"https://api.github.com/repos/itheof/42sh-posix/deployments","created_at":"2016-09-26T15:30:13Z","updated_at":"2016-10-04T10:02:04Z","pushed_at":"2016-10-10T18:16:08Z","git_url":"git://github.com/itheof/42sh-posix.git","ssh_url":"git@github.com:itheof/42sh-posix.git","clone_url":"https://github.com/itheof/42sh-posix.git","svn_url":"https://github.com/itheof/42sh-posix","homepage":null,"size":120,"stargazers_count":3,"watchers_count":3,"language":"Makefile","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":3,"default_branch":"master"}},"base":{"label":"itheof:master","ref":"master","sha":"70c19dc2441333e2ad3ef52493d8b51f47efd565","user":{"login":"itheof","id":8781784,"avatar_url":"https://avatars.githubusercontent.com/u/8781784?v=3","gravatar_id":"","url":"https://api.github.com/users/itheof","html_url":"https://github.com/itheof","followers_url":"https://api.github.com/users/itheof/followers","following_url":"https://api.github.com/users/itheof/following{/other_user}","gists_url":"https://api.github.com/users/itheof/gists{/gist_id}","starred_url":"https://api.github.com/users/itheof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itheof/subscriptions","organizations_url":"https://api.github.com/users/itheof/orgs","repos_url":"https://api.github.com/users/itheof/repos","events_url":"https://api.github.com/users/itheof/events{/privacy}","received_events_url":"https://api.github.com/users/itheof/received_events","type":"User","site_admin":false},"repo":{"id":69264329,"name":"42sh-posix","full_name":"itheof/42sh-posix","owner":{"login":"itheof","id":8781784,"avatar_url":"https://avatars.githubusercontent.com/u/8781784?v=3","gravatar_id":"","url":"https://api.github.com/users/itheof","html_url":"https://github.com/itheof","followers_url":"https://api.github.com/users/itheof/followers","following_url":"https://api.github.com/users/itheof/following{/other_user}","gists_url":"https://api.github.com/users/itheof/gists{/gist_id}","starred_url":"https://api.github.com/users/itheof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itheof/subscriptions","organizations_url":"https://api.github.com/users/itheof/orgs","repos_url":"https://api.github.com/users/itheof/repos","events_url":"https://api.github.com/users/itheof/events{/privacy}","received_events_url":"https://api.github.com/users/itheof/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/itheof/42sh-posix","description":null,"fork":false,"url":"https://api.github.com/repos/itheof/42sh-posix","forks_url":"https://api.github.com/repos/itheof/42sh-posix/forks","keys_url":"https://api.github.com/repos/itheof/42sh-posix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itheof/42sh-posix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itheof/42sh-posix/teams","hooks_url":"https://api.github.com/repos/itheof/42sh-posix/hooks","issue_events_url":"https://api.github.com/repos/itheof/42sh-posix/issues/events{/number}","events_url":"https://api.github.com/repos/itheof/42sh-posix/events","assignees_url":"https://api.github.com/repos/itheof/42sh-posix/assignees{/user}","branches_url":"https://api.github.com/repos/itheof/42sh-posix/branches{/branch}","tags_url":"https://api.github.com/repos/itheof/42sh-posix/tags","blobs_url":"https://api.github.com/repos/itheof/42sh-posix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itheof/42sh-posix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itheof/42sh-posix/git/refs{/sha}","trees_url":"https://api.github.com/repos/itheof/42sh-posix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itheof/42sh-posix/statuses/{sha}","languages_url":"https://api.github.com/repos/itheof/42sh-posix/languages","stargazers_url":"https://api.github.com/repos/itheof/42sh-posix/stargazers","contributors_url":"https://api.github.com/repos/itheof/42sh-posix/contributors","subscribers_url":"https://api.github.com/repos/itheof/42sh-posix/subscribers","subscription_url":"https://api.github.com/repos/itheof/42sh-posix/subscription","commits_url":"https://api.github.com/repos/itheof/42sh-posix/commits{/sha}","git_commits_url":"https://api.github.com/repos/itheof/42sh-posix/git/commits{/sha}","comments_url":"https://api.github.com/repos/itheof/42sh-posix/comments{/number}","issue_comment_url":"https://api.github.com/repos/itheof/42sh-posix/issues/comments{/number}","contents_url":"https://api.github.com/repos/itheof/42sh-posix/contents/{+path}","compare_url":"https://api.github.com/repos/itheof/42sh-posix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itheof/42sh-posix/merges","archive_url":"https://api.github.com/repos/itheof/42sh-posix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itheof/42sh-posix/downloads","issues_url":"https://api.github.com/repos/itheof/42sh-posix/issues{/number}","pulls_url":"https://api.github.com/repos/itheof/42sh-posix/pulls{/number}","milestones_url":"https://api.github.com/repos/itheof/42sh-posix/milestones{/number}","notifications_url":"https://api.github.com/repos/itheof/42sh-posix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itheof/42sh-posix/labels{/name}","releases_url":"https://api.github.com/repos/itheof/42sh-posix/releases{/id}","deployments_url":"https://api.github.com/repos/itheof/42sh-posix/deployments","created_at":"2016-09-26T15:30:13Z","updated_at":"2016-10-04T10:02:04Z","pushed_at":"2016-10-10T18:16:08Z","git_url":"git://github.com/itheof/42sh-posix.git","ssh_url":"git@github.com:itheof/42sh-posix.git","clone_url":"https://github.com/itheof/42sh-posix.git","svn_url":"https://github.com/itheof/42sh-posix","homepage":null,"size":120,"stargazers_count":3,"watchers_count":3,"language":"Makefile","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/21"},"html":{"href":"https://github.com/itheof/42sh-posix/pull/21"},"issue":{"href":"https://api.github.com/repos/itheof/42sh-posix/issues/21"},"comments":{"href":"https://api.github.com/repos/itheof/42sh-posix/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/itheof/42sh-posix/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/itheof/42sh-posix/statuses/51625c35e7b6034719cf7c49e804e3be0ce4564c"}}}}
{"actor":{"display_login":"tmielcza"}}