{"action":"opened","number":1652,"pull_request":{"url":"https://api.github.com/repos/systemd/systemd/pulls/1652","id":48546157,"html_url":"https://github.com/systemd/systemd/pull/1652","diff_url":"https://github.com/systemd/systemd/pull/1652.diff","patch_url":"https://github.com/systemd/systemd/pull/1652.patch","issue_url":"https://api.github.com/repos/systemd/systemd/issues/1652","number":1652,"state":"open","locked":false,"title":"util: Replace state with separate booleans in extract_first_word","user":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"body":"This simplifies the logic and uniformizes the way single and double quotes are handled. In the end, the code is about 40 lines shorter.\r\n\r\nI thought of parts of this a while ago (in particular tracking the backslash separate from the other states)... decided to revisit after seeing #1642 from @evverx and noticed we could be smarter about tracking quotes to match the end quote.\r\n\r\nA possible follow up is to move the loop inside the if branches and only breaking out when the state actually needs to change... That would be more efficient than checking the current state for each character... It's probably a fairly small change after this one goes in.\r\n\r\n@poettering and @evverx Let me know what you think of it!\r\n\r\nCheers,\r\nFilipe\r\n","created_at":"2015-10-23T06:27:24Z","updated_at":"2015-10-23T06:27:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/systemd/systemd/pulls/1652/commits","review_comments_url":"https://api.github.com/repos/systemd/systemd/pulls/1652/comments","review_comment_url":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/1652/comments","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/4cbf8afa0487b75525313b586853823ba5763d8e","head":{"label":"filbranden:extract1","ref":"extract1","sha":"4cbf8afa0487b75525313b586853823ba5763d8e","user":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"repo":{"id":36740003,"name":"systemd","full_name":"filbranden/systemd","owner":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/filbranden/systemd","description":"systemd upstream repository","fork":true,"url":"https://api.github.com/repos/filbranden/systemd","forks_url":"https://api.github.com/repos/filbranden/systemd/forks","keys_url":"https://api.github.com/repos/filbranden/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/filbranden/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/filbranden/systemd/teams","hooks_url":"https://api.github.com/repos/filbranden/systemd/hooks","issue_events_url":"https://api.github.com/repos/filbranden/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/filbranden/systemd/events","assignees_url":"https://api.github.com/repos/filbranden/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/filbranden/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/filbranden/systemd/tags","blobs_url":"https://api.github.com/repos/filbranden/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/filbranden/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/filbranden/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/filbranden/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/filbranden/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/filbranden/systemd/languages","stargazers_url":"https://api.github.com/repos/filbranden/systemd/stargazers","contributors_url":"https://api.github.com/repos/filbranden/systemd/contributors","subscribers_url":"https://api.github.com/repos/filbranden/systemd/subscribers","subscription_url":"https://api.github.com/repos/filbranden/systemd/subscription","commits_url":"https://api.github.com/repos/filbranden/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/filbranden/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/filbranden/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/filbranden/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/filbranden/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/filbranden/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/filbranden/systemd/merges","archive_url":"https://api.github.com/repos/filbranden/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/filbranden/systemd/downloads","issues_url":"https://api.github.com/repos/filbranden/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/filbranden/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/filbranden/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/filbranden/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/filbranden/systemd/labels{/name}","releases_url":"https://api.github.com/repos/filbranden/systemd/releases{/id}","created_at":"2015-06-02T14:46:51Z","updated_at":"2015-06-02T14:46:56Z","pushed_at":"2015-10-23T06:21:53Z","git_url":"git://github.com/filbranden/systemd.git","ssh_url":"git@github.com:filbranden/systemd.git","clone_url":"https://github.com/filbranden/systemd.git","svn_url":"https://github.com/filbranden/systemd","homepage":"http://www.freedesktop.org/wiki/Software/systemd/","size":42814,"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":"systemd:master","ref":"master","sha":"c9fc270e462bf2f4eab963bf71234d64b0c4c30f","user":{"login":"systemd","id":1918868,"avatar_url":"https://avatars.githubusercontent.com/u/1918868?v=3","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"repo":{"id":32873313,"name":"systemd","full_name":"systemd/systemd","owner":{"login":"systemd","id":1918868,"avatar_url":"https://avatars.githubusercontent.com/u/1918868?v=3","gravatar_id":"","url":"https://api.github.com/users/systemd","html_url":"https://github.com/systemd","followers_url":"https://api.github.com/users/systemd/followers","following_url":"https://api.github.com/users/systemd/following{/other_user}","gists_url":"https://api.github.com/users/systemd/gists{/gist_id}","starred_url":"https://api.github.com/users/systemd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systemd/subscriptions","organizations_url":"https://api.github.com/users/systemd/orgs","repos_url":"https://api.github.com/users/systemd/repos","events_url":"https://api.github.com/users/systemd/events{/privacy}","received_events_url":"https://api.github.com/users/systemd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systemd/systemd","description":"systemd upstream","fork":false,"url":"https://api.github.com/repos/systemd/systemd","forks_url":"https://api.github.com/repos/systemd/systemd/forks","keys_url":"https://api.github.com/repos/systemd/systemd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systemd/systemd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systemd/systemd/teams","hooks_url":"https://api.github.com/repos/systemd/systemd/hooks","issue_events_url":"https://api.github.com/repos/systemd/systemd/issues/events{/number}","events_url":"https://api.github.com/repos/systemd/systemd/events","assignees_url":"https://api.github.com/repos/systemd/systemd/assignees{/user}","branches_url":"https://api.github.com/repos/systemd/systemd/branches{/branch}","tags_url":"https://api.github.com/repos/systemd/systemd/tags","blobs_url":"https://api.github.com/repos/systemd/systemd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systemd/systemd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systemd/systemd/git/refs{/sha}","trees_url":"https://api.github.com/repos/systemd/systemd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systemd/systemd/statuses/{sha}","languages_url":"https://api.github.com/repos/systemd/systemd/languages","stargazers_url":"https://api.github.com/repos/systemd/systemd/stargazers","contributors_url":"https://api.github.com/repos/systemd/systemd/contributors","subscribers_url":"https://api.github.com/repos/systemd/systemd/subscribers","subscription_url":"https://api.github.com/repos/systemd/systemd/subscription","commits_url":"https://api.github.com/repos/systemd/systemd/commits{/sha}","git_commits_url":"https://api.github.com/repos/systemd/systemd/git/commits{/sha}","comments_url":"https://api.github.com/repos/systemd/systemd/comments{/number}","issue_comment_url":"https://api.github.com/repos/systemd/systemd/issues/comments{/number}","contents_url":"https://api.github.com/repos/systemd/systemd/contents/{+path}","compare_url":"https://api.github.com/repos/systemd/systemd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systemd/systemd/merges","archive_url":"https://api.github.com/repos/systemd/systemd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systemd/systemd/downloads","issues_url":"https://api.github.com/repos/systemd/systemd/issues{/number}","pulls_url":"https://api.github.com/repos/systemd/systemd/pulls{/number}","milestones_url":"https://api.github.com/repos/systemd/systemd/milestones{/number}","notifications_url":"https://api.github.com/repos/systemd/systemd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systemd/systemd/labels{/name}","releases_url":"https://api.github.com/repos/systemd/systemd/releases{/id}","created_at":"2015-03-25T15:27:27Z","updated_at":"2015-10-22T19:14:44Z","pushed_at":"2015-10-23T04:10:29Z","git_url":"git://github.com/systemd/systemd.git","ssh_url":"git@github.com:systemd/systemd.git","clone_url":"https://github.com/systemd/systemd.git","svn_url":"https://github.com/systemd/systemd","homepage":"http://www.freedesktop.org/wiki/Software/systemd/","size":54498,"stargazers_count":641,"watchers_count":641,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":241,"mirror_url":null,"open_issues_count":232,"forks":241,"open_issues":232,"watchers":641,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systemd/systemd/pulls/1652"},"html":{"href":"https://github.com/systemd/systemd/pull/1652"},"issue":{"href":"https://api.github.com/repos/systemd/systemd/issues/1652"},"comments":{"href":"https://api.github.com/repos/systemd/systemd/issues/1652/comments"},"review_comments":{"href":"https://api.github.com/repos/systemd/systemd/pulls/1652/comments"},"review_comment":{"href":"https://api.github.com/repos/systemd/systemd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systemd/systemd/pulls/1652/commits"},"statuses":{"href":"https://api.github.com/repos/systemd/systemd/statuses/4cbf8afa0487b75525313b586853823ba5763d8e"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":50,"deletions":89,"changed_files":1}}