Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Overall cleanup of lib. #1903

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 76 additions & 63 deletions lib/_debugger.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function Buffer(subject, encoding, offset) {
}
}

SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length);
return SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length);
}

function isArrayIsh(subject) {
Expand Down
4 changes: 1 addition & 3 deletions lib/buffer_ieee754.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) {

for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);

e = (e << mLen) | m;
eLen += mLen;
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
for (eLen += mLen; eLen > 0; buffer[offset + i] = (e = (e << mLen) | m) & 0xff, i += d, e /= 256, eLen -= 8);

buffer[offset + i - d] |= s * 128;
};
17 changes: 9 additions & 8 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,26 @@ exports.execFile = function(file /* args, options, callback */) {
var err;

function exithandler(code, signal) {
if (exited) return;
if (exited) return null;
exited = true;

if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}

if (!callback) return;
if (!callback) return null;

if (err) {
callback(err, stdout, stderr);
return callback(err, stdout, stderr);
} else if (code === 0 && signal === null) {
callback(null, stdout, stderr);
return callback(null, stdout, stderr);
} else {
var e = new Error('Command failed: ' + stderr);
e.killed = child.killed || killed;
e.code = code;
e.signal = signal;
callback(e, stdout, stderr);
return callback(e, stdout, stderr);
}
}

Expand Down Expand Up @@ -303,7 +303,7 @@ exports.execFile = function(file /* args, options, callback */) {


var spawn = exports.spawn = function(file, args, options) {
var args = args ? args.slice(0) : [];
args = args ? args.slice(0) : [];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this for Pull Req #1

args.unshift(file);

var env = (options ? options.env : null) || process.env;
Expand Down Expand Up @@ -376,7 +376,7 @@ inherits(ChildProcess, EventEmitter);

function setStreamOption(name, index, options) {
// Skip if we already have options.stdinStream
if (options[name]) return;
if (options[name]) return null;

if (options.customFds &&
typeof options.customFds[index] == 'number' &&
Expand All @@ -386,8 +386,9 @@ function setStreamOption(name, index, options) {
} else {
throw new Error('customFds not yet supported');
}
return null;
} else {
options[name] = createPipe();
return options[name] = createPipe();
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Credentials(secureProtocol, flags, context) {
}
}

if (flags) this.context.setOptions(flags);
return (flags) ? this.context.setOptions(flags) : null;
}

exports.Credentials = Credentials;
Expand Down
6 changes: 4 additions & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Socket.prototype._healthCheck = function() {

Socket.prototype._startReceiving = function() {
if (this._receiving)
return;
return null;

if (!this._bound) {
this.bind(); // bind to random port
Expand All @@ -278,12 +278,13 @@ Socket.prototype._startReceiving = function() {
this._handle.recvStart();
this._receiving = true;
this.fd = -42; // compatibility hack
return null;
};


Socket.prototype._stopReceiving = function() {
if (!this._receiving)
return;
return null;

// Black hole messages coming in when reading is stopped. Libuv might do
// this, but node applications (e.g. test/simple/test-dgram-pingpong) may
Expand All @@ -293,6 +294,7 @@ Socket.prototype._stopReceiving = function() {
this._handle.recvStop();
this._receiving = false;
this.fd = null; // compatibility hack
return null;
};


Expand Down
Loading