Skip to content

Commit

Permalink
http: remove unused hasItems() from freelist
Browse files Browse the repository at this point in the history
Remove the hasItems() method from freelist module as it is unused
internally.

PR-URL: nodejs#30744
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
  • Loading branch information
Trott committed Dec 3, 2019
1 parent dbdad4d commit ff2ed3e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
4 changes: 0 additions & 4 deletions lib/internal/freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class FreeList {
this.list = [];
}

hasItems() {
return this.list.length > 0;
}

alloc() {
return this.list.length > 0 ?
this.list.pop() :
Expand Down
10 changes: 0 additions & 10 deletions test/parallel/test-freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,3 @@ assert.strictEqual(flist1.free({ id: 'test5' }), false);
assert.strictEqual(flist1.alloc().id, 'test3');
assert.strictEqual(flist1.alloc().id, 'test2');
assert.strictEqual(flist1.alloc().id, 'test1');

// Check list has elements
const flist2 = new FreeList('flist2', 2, Object);
assert.strictEqual(flist2.hasItems(), false);

flist2.free({ id: 'test1' });
assert.strictEqual(flist2.hasItems(), true);

flist2.alloc();
assert.strictEqual(flist2.hasItems(), false);

0 comments on commit ff2ed3e

Please sign in to comment.