Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47befff

Browse filesBrowse files
committed
lib,test: deprecate _linklist
Deprecate _linklist and add test to confirm internal linklist and public _linklist are the same. PR-URL: #3078 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
1 parent 01908d0 commit 47befff
Copy full SHA for 47befff

File tree

Expand file treeCollapse file tree

5 files changed

+72
-60
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+72
-60
lines changed
Open diff view settings
Collapse file

‎lib/_linklist.js‎

Copy file name to clipboard
+3-54Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,6 @@
11
'use strict';
22

3-
function init(list) {
4-
list._idleNext = list;
5-
list._idlePrev = list;
6-
}
7-
exports.init = init;
3+
const msg = require('internal/util').printDeprecationMessage;
84

9-
10-
// show the most idle item
11-
function peek(list) {
12-
if (list._idlePrev == list) return null;
13-
return list._idlePrev;
14-
}
15-
exports.peek = peek;
16-
17-
18-
// remove the most idle item from the list
19-
function shift(list) {
20-
var first = list._idlePrev;
21-
remove(first);
22-
return first;
23-
}
24-
exports.shift = shift;
25-
26-
27-
// remove a item from its list
28-
function remove(item) {
29-
if (item._idleNext) {
30-
item._idleNext._idlePrev = item._idlePrev;
31-
}
32-
33-
if (item._idlePrev) {
34-
item._idlePrev._idleNext = item._idleNext;
35-
}
36-
37-
item._idleNext = null;
38-
item._idlePrev = null;
39-
}
40-
exports.remove = remove;
41-
42-
43-
// remove a item from its list and place at the end.
44-
function append(list, item) {
45-
remove(item);
46-
item._idleNext = list._idleNext;
47-
list._idleNext._idlePrev = item;
48-
item._idlePrev = list;
49-
list._idleNext = item;
50-
}
51-
exports.append = append;
52-
53-
54-
function isEmpty(list) {
55-
return list._idleNext === list;
56-
}
57-
exports.isEmpty = isEmpty;
5+
module.exports = require('internal/linkedlist');
6+
msg('_linklist module is deprecated. Please use a userland alternative.');
Collapse file

‎lib/internal/linkedlist.js‎

Copy file name to clipboard
+57Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'use strict';
2+
3+
function init(list) {
4+
list._idleNext = list;
5+
list._idlePrev = list;
6+
}
7+
exports.init = init;
8+
9+
10+
// show the most idle item
11+
function peek(list) {
12+
if (list._idlePrev == list) return null;
13+
return list._idlePrev;
14+
}
15+
exports.peek = peek;
16+
17+
18+
// remove the most idle item from the list
19+
function shift(list) {
20+
var first = list._idlePrev;
21+
remove(first);
22+
return first;
23+
}
24+
exports.shift = shift;
25+
26+
27+
// remove a item from its list
28+
function remove(item) {
29+
if (item._idleNext) {
30+
item._idleNext._idlePrev = item._idlePrev;
31+
}
32+
33+
if (item._idlePrev) {
34+
item._idlePrev._idleNext = item._idleNext;
35+
}
36+
37+
item._idleNext = null;
38+
item._idlePrev = null;
39+
}
40+
exports.remove = remove;
41+
42+
43+
// remove a item from its list and place at the end.
44+
function append(list, item) {
45+
remove(item);
46+
item._idleNext = list._idleNext;
47+
list._idleNext._idlePrev = item;
48+
item._idlePrev = list;
49+
list._idleNext = item;
50+
}
51+
exports.append = append;
52+
53+
54+
function isEmpty(list) {
55+
return list._idleNext === list;
56+
}
57+
exports.isEmpty = isEmpty;
Collapse file

‎lib/timers.js‎

Copy file name to clipboardExpand all lines: lib/timers.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const Timer = process.binding('timer_wrap').Timer;
4-
const L = require('_linklist');
4+
const L = require('internal/linkedlist');
55
const assert = require('assert').ok;
66
const util = require('util');
77
const debug = util.debuglog('timer');
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
'src/node.js',
1818
'lib/_debug_agent.js',
1919
'lib/_debugger.js',
20-
'lib/_linklist.js',
2120
'lib/assert.js',
2221
'lib/buffer.js',
2322
'lib/child_process.js',
@@ -39,6 +38,7 @@
3938
'lib/_http_outgoing.js',
4039
'lib/_http_server.js',
4140
'lib/https.js',
41+
'lib/_linklist.js',
4242
'lib/module.js',
4343
'lib/net.js',
4444
'lib/os.js',
@@ -70,9 +70,10 @@
7070
'lib/zlib.js',
7171
'lib/internal/child_process.js',
7272
'lib/internal/freelist.js',
73+
'lib/internal/linkedlist.js',
7374
'lib/internal/module.js',
74-
'lib/internal/socket_list.js',
7575
'lib/internal/repl.js',
76+
'lib/internal/socket_list.js',
7677
'lib/internal/util.js',
7778
'lib/internal/streams/lazy_transform.js',
7879
],
Collapse file

‎test/parallel/test-timers-linked-list.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-timers-linked-list.js
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var L = require('_linklist');
52

3+
// Flags: --expose-internals
4+
5+
const common = require('../common');
6+
const assert = require('assert');
7+
const L = require('_linklist');
8+
const internalL = require('internal/linkedlist');
9+
10+
assert.strictEqual(L, internalL);
611

712
var list = { name: 'list' };
813
var A = { name: 'A' };

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.