Skip to content
Permalink
Browse files

http: remove unused hasItems() from freelist

Remove the hasItems() method from freelist module as it is unused
internally.

PR-URL: #30744
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Weijia Wang <starkwang@126.com>
  • Loading branch information
Trott committed Dec 1, 2019
1 parent dbdad4d commit ff2ed3ec858bfed9e2d31e0510614ed3931b499a
Showing with 0 additions and 14 deletions.
  1. +0 −4 lib/internal/freelist.js
  2. +0 −10 test/parallel/test-freelist.js
@@ -12,10 +12,6 @@ class FreeList {
this.list = [];
}

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

alloc() {
return this.list.length > 0 ?
this.list.pop() :
@@ -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.
You can’t perform that action at this time.