{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/49787340","id":49787340,"diff_hunk":"@@ -0,0 +1,17 @@\n+'use strict';\n+\n+require('../common');\n+const SlowBuffer = require('buffer').SlowBuffer;\n+const assert = require('assert');\n+\n+const safe = Buffer.zalloc(10);\n+const safeslow = SlowBuffer.zalloc(10);\n+\n+function isZeroFilled(buf) {\n+  for (let n = 0; n < buf.length; n++)\n+    if (buf[n] > 0) return false;\n+  return true;\n+}","path":"test/parallel/test-buffer-safe-unsafe.js","position":14,"original_position":14,"commit_id":"d5ab954c866b4c608b5b5efded321d10b6b47b35","original_commit_id":"d5ab954c866b4c608b5b5efded321d10b6b47b35","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"body":"Yeah, I was going to get back to that to see. The best approach I can think of is to do a whole bunch of allocations and test all of them","created_at":"2016-01-14T21:24:25Z","updated_at":"2016-01-14T21:24:25Z","html_url":"https://github.com/nodejs/node/pull/4682#discussion_r49787340","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/4682","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/49787340"},"html":{"href":"https://github.com/nodejs/node/pull/4682#discussion_r49787340"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/4682"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/4682","id":55991304,"html_url":"https://github.com/nodejs/node/pull/4682","diff_url":"https://github.com/nodejs/node/pull/4682.diff","patch_url":"https://github.com/nodejs/node/pull/4682.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/4682","number":4682,"state":"open","locked":false,"title":"buffer: add Buffer.zalloc() and Buffer.alloc(), deprecate Buffer(num)","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"body":"This is currently a work in progress for discussion purposes. Please do not land!\r\n\r\nPer the discussion in https://github.com/nodejs/node/issues/4660, this adds ~~`Buffer.safe()` and `Buffer.unsafe()`~~ `Buffer.zalloc()` and `Buffer.alloc()` and deprecates `Buffer(num)`. Every existing call to `Buffer(num)` in the tests is modified to use `Buffer.alloc()` except for one intentionally left to cover the `Buffer(num, enc)` error case.\r\n\r\n`Buffer.alloc()` uses the same implementation as `Buffer(num)` (with slightly modified input arg verification) which uses slab allocation to allocate non-zero filled Buffers as efficiently as possible.\r\n\r\n`Buffer.zalloc()` currently uses `Buffer.zalloc(len).fill(0)` to create a brand new zero-filled Buffer.\r\n\r\nNote: PR description updated to reflect new naming and implementation details","created_at":"2016-01-14T04:23:32Z","updated_at":"2016-01-14T21:24:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"791496a1dc624411e2bb5eef5ce13f7458b4d45c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/4682/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/4682/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/4682/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/d5ab954c866b4c608b5b5efded321d10b6b47b35","head":{"label":"jasnell:buffer-safe","ref":"buffer-safe","sha":"d5ab954c866b4c608b5b5efded321d10b6b47b35","user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"repo":{"id":37868459,"name":"node","full_name":"jasnell/node","owner":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasnell/node","description":"Future Node.js releases will be based on io.js","fork":true,"url":"https://api.github.com/repos/jasnell/node","forks_url":"https://api.github.com/repos/jasnell/node/forks","keys_url":"https://api.github.com/repos/jasnell/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasnell/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasnell/node/teams","hooks_url":"https://api.github.com/repos/jasnell/node/hooks","issue_events_url":"https://api.github.com/repos/jasnell/node/issues/events{/number}","events_url":"https://api.github.com/repos/jasnell/node/events","assignees_url":"https://api.github.com/repos/jasnell/node/assignees{/user}","branches_url":"https://api.github.com/repos/jasnell/node/branches{/branch}","tags_url":"https://api.github.com/repos/jasnell/node/tags","blobs_url":"https://api.github.com/repos/jasnell/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasnell/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasnell/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasnell/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasnell/node/statuses/{sha}","languages_url":"https://api.github.com/repos/jasnell/node/languages","stargazers_url":"https://api.github.com/repos/jasnell/node/stargazers","contributors_url":"https://api.github.com/repos/jasnell/node/contributors","subscribers_url":"https://api.github.com/repos/jasnell/node/subscribers","subscription_url":"https://api.github.com/repos/jasnell/node/subscription","commits_url":"https://api.github.com/repos/jasnell/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasnell/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasnell/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasnell/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasnell/node/contents/{+path}","compare_url":"https://api.github.com/repos/jasnell/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasnell/node/merges","archive_url":"https://api.github.com/repos/jasnell/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasnell/node/downloads","issues_url":"https://api.github.com/repos/jasnell/node/issues{/number}","pulls_url":"https://api.github.com/repos/jasnell/node/pulls{/number}","milestones_url":"https://api.github.com/repos/jasnell/node/milestones{/number}","notifications_url":"https://api.github.com/repos/jasnell/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasnell/node/labels{/name}","releases_url":"https://api.github.com/repos/jasnell/node/releases{/id}","created_at":"2015-06-22T17:01:18Z","updated_at":"2016-01-11T18:47:43Z","pushed_at":"2016-01-14T20:23:37Z","git_url":"git://github.com/jasnell/node.git","ssh_url":"git@github.com:jasnell/node.git","clone_url":"https://github.com/jasnell/node.git","svn_url":"https://github.com/jasnell/node","homepage":"https://iojs.org","size":164998,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"8182ec094d25f86d57803a2c17e3847f98050e94","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-01-14T21:22:27Z","pushed_at":"2016-01-14T20:23:38Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":182513,"stargazers_count":19161,"watchers_count":19161,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2265,"mirror_url":null,"open_issues_count":680,"forks":2265,"open_issues":680,"watchers":19161,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/4682"},"html":{"href":"https://github.com/nodejs/node/pull/4682"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/4682"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/4682/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/4682/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/4682/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/d5ab954c866b4c608b5b5efded321d10b6b47b35"}}}}