{"action":"created","comment":{"url":"https://api.github.com/repos/neovim/neovim/pulls/comments/31385604","id":31385604,"diff_hunk":"@@ -92,27 +115,15 @@ void job_teardown(void)\n /// @return The job pointer if the job started successfully, NULL otherwise\n Job *job_start(JobOptions opts, int *status)\n {\n-  int i;\n-  Job *job;\n-\n-  // Search for a free slot in the table\n-  for (i = 0; i < MAX_RUNNING_JOBS; i++) {\n-    if (table[i] == NULL) {\n-      break;\n-    }\n-  }\n+  Job *job = xmalloc(sizeof(Job));\n \n-  if (i == MAX_RUNNING_JOBS) {\n-    // No free slots\n-    shell_free_argv(opts.argv);\n-    *status = 0;\n+  // Initialize\n+  job->id = new_job_id();\n+  *status = job->id;\n+  if (*status == -1) {","path":"src/nvim/os/job.c","position":null,"original_position":97,"commit_id":"beb07ca886f479e73680fc97344466636adaa476","original_commit_id":"9406b643ff398fac72b907149b4a302772d68015","user":{"login":"splinterofchaos","id":38515,"avatar_url":"https://avatars.githubusercontent.com/u/38515?v=3","gravatar_id":"","url":"https://api.github.com/users/splinterofchaos","html_url":"https://github.com/splinterofchaos","followers_url":"https://api.github.com/users/splinterofchaos/followers","following_url":"https://api.github.com/users/splinterofchaos/following{/other_user}","gists_url":"https://api.github.com/users/splinterofchaos/gists{/gist_id}","starred_url":"https://api.github.com/users/splinterofchaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/splinterofchaos/subscriptions","organizations_url":"https://api.github.com/users/splinterofchaos/orgs","repos_url":"https://api.github.com/users/splinterofchaos/repos","events_url":"https://api.github.com/users/splinterofchaos/events{/privacy}","received_events_url":"https://api.github.com/users/splinterofchaos/received_events","type":"User","site_admin":false},"body":":+1: -- actually, if we can't allocate a job ID, might as well not `xmalloc()` to begin with.","created_at":"2015-05-31T00:01:14Z","updated_at":"2015-05-31T00:01:14Z","html_url":"https://github.com/neovim/neovim/pull/2771#discussion_r31385604","pull_request_url":"https://api.github.com/repos/neovim/neovim/pulls/2771","_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments/31385604"},"html":{"href":"https://github.com/neovim/neovim/pull/2771#discussion_r31385604"},"pull_request":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2771"}}},"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/2771","id":36570295,"html_url":"https://github.com/neovim/neovim/pull/2771","diff_url":"https://github.com/neovim/neovim/pull/2771.diff","patch_url":"https://github.com/neovim/neovim/pull/2771.patch","issue_url":"https://api.github.com/repos/neovim/neovim/issues/2771","number":2771,"state":"open","locked":false,"title":"[RFC] jobs: use PIDs for job IDs","user":{"login":"splinterofchaos","id":38515,"avatar_url":"https://avatars.githubusercontent.com/u/38515?v=3","gravatar_id":"","url":"https://api.github.com/users/splinterofchaos","html_url":"https://github.com/splinterofchaos","followers_url":"https://api.github.com/users/splinterofchaos/followers","following_url":"https://api.github.com/users/splinterofchaos/following{/other_user}","gists_url":"https://api.github.com/users/splinterofchaos/gists{/gist_id}","starred_url":"https://api.github.com/users/splinterofchaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/splinterofchaos/subscriptions","organizations_url":"https://api.github.com/users/splinterofchaos/orgs","repos_url":"https://api.github.com/users/splinterofchaos/repos","events_url":"https://api.github.com/users/splinterofchaos/events{/privacy}","received_events_url":"https://api.github.com/users/splinterofchaos/received_events","type":"User","site_admin":false},"body":"From the commit message:\r\n\r\nScript writers assume that job IDs uniquely identify them, but using\r\ntheir index in the job table can break this assumption because the\r\nindices will be re-used.\r\n\r\n~~Process IDs make ideal, unique identifiers, so store jobs in a map with\r\ntheir PID as they key, and also contains more useful information for\r\nusers.~~ An increment only counter is used instead.\r\n\r\nfixes #2162","created_at":"2015-05-30T19:06:09Z","updated_at":"2015-05-31T00:01:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbec3c6aa00b136fec20bb12601e2aa16e7f4cc9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neovim/neovim/pulls/2771/commits","review_comments_url":"https://api.github.com/repos/neovim/neovim/pulls/2771/comments","review_comment_url":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/2771/comments","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/beb07ca886f479e73680fc97344466636adaa476","head":{"label":"splinterofchaos:job-pid","ref":"job-pid","sha":"beb07ca886f479e73680fc97344466636adaa476","user":{"login":"splinterofchaos","id":38515,"avatar_url":"https://avatars.githubusercontent.com/u/38515?v=3","gravatar_id":"","url":"https://api.github.com/users/splinterofchaos","html_url":"https://github.com/splinterofchaos","followers_url":"https://api.github.com/users/splinterofchaos/followers","following_url":"https://api.github.com/users/splinterofchaos/following{/other_user}","gists_url":"https://api.github.com/users/splinterofchaos/gists{/gist_id}","starred_url":"https://api.github.com/users/splinterofchaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/splinterofchaos/subscriptions","organizations_url":"https://api.github.com/users/splinterofchaos/orgs","repos_url":"https://api.github.com/users/splinterofchaos/repos","events_url":"https://api.github.com/users/splinterofchaos/events{/privacy}","received_events_url":"https://api.github.com/users/splinterofchaos/received_events","type":"User","site_admin":false},"repo":{"id":21571013,"name":"neovim","full_name":"splinterofchaos/neovim","owner":{"login":"splinterofchaos","id":38515,"avatar_url":"https://avatars.githubusercontent.com/u/38515?v=3","gravatar_id":"","url":"https://api.github.com/users/splinterofchaos","html_url":"https://github.com/splinterofchaos","followers_url":"https://api.github.com/users/splinterofchaos/followers","following_url":"https://api.github.com/users/splinterofchaos/following{/other_user}","gists_url":"https://api.github.com/users/splinterofchaos/gists{/gist_id}","starred_url":"https://api.github.com/users/splinterofchaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/splinterofchaos/subscriptions","organizations_url":"https://api.github.com/users/splinterofchaos/orgs","repos_url":"https://api.github.com/users/splinterofchaos/repos","events_url":"https://api.github.com/users/splinterofchaos/events{/privacy}","received_events_url":"https://api.github.com/users/splinterofchaos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/splinterofchaos/neovim","description":"vim for the 21st century","fork":true,"url":"https://api.github.com/repos/splinterofchaos/neovim","forks_url":"https://api.github.com/repos/splinterofchaos/neovim/forks","keys_url":"https://api.github.com/repos/splinterofchaos/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/splinterofchaos/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/splinterofchaos/neovim/teams","hooks_url":"https://api.github.com/repos/splinterofchaos/neovim/hooks","issue_events_url":"https://api.github.com/repos/splinterofchaos/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/splinterofchaos/neovim/events","assignees_url":"https://api.github.com/repos/splinterofchaos/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/splinterofchaos/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/splinterofchaos/neovim/tags","blobs_url":"https://api.github.com/repos/splinterofchaos/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/splinterofchaos/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/splinterofchaos/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/splinterofchaos/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/splinterofchaos/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/splinterofchaos/neovim/languages","stargazers_url":"https://api.github.com/repos/splinterofchaos/neovim/stargazers","contributors_url":"https://api.github.com/repos/splinterofchaos/neovim/contributors","subscribers_url":"https://api.github.com/repos/splinterofchaos/neovim/subscribers","subscription_url":"https://api.github.com/repos/splinterofchaos/neovim/subscription","commits_url":"https://api.github.com/repos/splinterofchaos/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/splinterofchaos/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/splinterofchaos/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/splinterofchaos/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/splinterofchaos/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/splinterofchaos/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/splinterofchaos/neovim/merges","archive_url":"https://api.github.com/repos/splinterofchaos/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/splinterofchaos/neovim/downloads","issues_url":"https://api.github.com/repos/splinterofchaos/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/splinterofchaos/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/splinterofchaos/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/splinterofchaos/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/splinterofchaos/neovim/labels{/name}","releases_url":"https://api.github.com/repos/splinterofchaos/neovim/releases{/id}","created_at":"2014-07-07T13:13:12Z","updated_at":"2015-04-15T19:23:11Z","pushed_at":"2015-05-30T23:58:24Z","git_url":"git://github.com/splinterofchaos/neovim.git","ssh_url":"git@github.com:splinterofchaos/neovim.git","clone_url":"https://github.com/splinterofchaos/neovim.git","svn_url":"https://github.com/splinterofchaos/neovim","homepage":"http://neovim.org/","size":33827,"stargazers_count":0,"watchers_count":0,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"neovim:master","ref":"master","sha":"8c84c124edf125ea7151488ccf8989a54e24da43","user":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"repo":{"id":16408992,"name":"neovim","full_name":"neovim/neovim","owner":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neovim/neovim","description":"ambitious Vim-fork focused on extensibility and agility. Please consider helping sustain Neovim development! https://salt.bountysource.com/teams/neovim","fork":false,"url":"https://api.github.com/repos/neovim/neovim","forks_url":"https://api.github.com/repos/neovim/neovim/forks","keys_url":"https://api.github.com/repos/neovim/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neovim/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neovim/neovim/teams","hooks_url":"https://api.github.com/repos/neovim/neovim/hooks","issue_events_url":"https://api.github.com/repos/neovim/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/neovim/neovim/events","assignees_url":"https://api.github.com/repos/neovim/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/neovim/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/neovim/neovim/tags","blobs_url":"https://api.github.com/repos/neovim/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neovim/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neovim/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/neovim/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/neovim/neovim/languages","stargazers_url":"https://api.github.com/repos/neovim/neovim/stargazers","contributors_url":"https://api.github.com/repos/neovim/neovim/contributors","subscribers_url":"https://api.github.com/repos/neovim/neovim/subscribers","subscription_url":"https://api.github.com/repos/neovim/neovim/subscription","commits_url":"https://api.github.com/repos/neovim/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/neovim/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/neovim/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/neovim/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/neovim/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/neovim/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neovim/neovim/merges","archive_url":"https://api.github.com/repos/neovim/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neovim/neovim/downloads","issues_url":"https://api.github.com/repos/neovim/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/neovim/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/neovim/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/neovim/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neovim/neovim/labels{/name}","releases_url":"https://api.github.com/repos/neovim/neovim/releases{/id}","created_at":"2014-01-31T13:39:22Z","updated_at":"2015-05-30T22:17:52Z","pushed_at":"2015-05-30T23:58:25Z","git_url":"git://github.com/neovim/neovim.git","ssh_url":"git@github.com:neovim/neovim.git","clone_url":"https://github.com/neovim/neovim.git","svn_url":"https://github.com/neovim/neovim","homepage":"http://neovim.io","size":79831,"stargazers_count":13511,"watchers_count":13511,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":926,"mirror_url":null,"open_issues_count":493,"forks":926,"open_issues":493,"watchers":13511,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2771"},"html":{"href":"https://github.com/neovim/neovim/pull/2771"},"issue":{"href":"https://api.github.com/repos/neovim/neovim/issues/2771"},"comments":{"href":"https://api.github.com/repos/neovim/neovim/issues/2771/comments"},"review_comments":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2771/comments"},"review_comment":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2771/commits"},"statuses":{"href":"https://api.github.com/repos/neovim/neovim/statuses/beb07ca886f479e73680fc97344466636adaa476"}}}}