Browse Source

quicker loops

v0.7.4-release
Aaron Heckmann 14 years ago
committed by Ryan Dahl
parent
commit
7c5cc57ece
  1. 2
      lib/child_process.js
  2. 4
      lib/crypto.js
  3. 14
      lib/dns.js
  4. 10
      lib/readline.js

2
lib/child_process.js

@ -51,7 +51,7 @@ exports.execFile = function (file /* args, options, callback */) {
// Merge optionArg into options
if (optionArg) {
var keys = Object.keys(options);
for (var i = 0; i < keys.length; i++) {
for (var i = 0, len = keys.length; i < len; i++) {
var k = keys[i];
if (optionArg[k] !== undefined) options[k] = optionArg[k];
}

4
lib/crypto.js

@ -3619,13 +3619,13 @@ exports.createCredentials = function(cred) {
if (cred.ca) {
c.shouldVerify = true;
if ( (typeof(cred.ca) == 'object') && cred.ca.length ) {
for(var i=0; i<cred.ca.length; i++)
for(var i = 0, len = cred.ca.length; i < len; i++)
c.context.addCACert(cred.ca[i]);
} else {
c.context.addCACert(cred.ca);
}
} else {
for (var i=0; i<RootCaCerts.length; i++) {
for (var i = 0, len = RootCaCerts.length; i < len; i++) {
c.context.addCACert(RootCaCerts[i]);
}
}

14
lib/dns.js

@ -26,16 +26,10 @@ function updateTimer() {
timer.stop();
// Were just checking to see if activeWatchers is empty or not
for (var socket in activeWatchers) {
if (activeWatchers.hasOwnProperty(socket)) {
var max = 20000;
var timeout = channel.timeout(max);
timer.start(timeout, 0);
// Short circuit the loop on first find.
return;
}
}
if (0 === Object.keys(activeWatchers).length) return;
var max = 20000;
var timeout = channel.timeout(max);
timer.start(timeout, 0);
}

10
lib/readline.js

@ -188,7 +188,7 @@ Interface.prototype._tabComplete = function () {
var item = group[idx];
self.output.write(item);
if (col < maxColumns - 1) {
for (var s = 0; s < width - item.length; s++) {
for (var s = 0, itemLen = item.length; s < width - itemLen; s++) {
self.output.write(' ');
}
}
@ -198,8 +198,8 @@ Interface.prototype._tabComplete = function () {
self.output.write('\r\n');
}
var group = [], c, i;
for (i = 0; i < completions.length; i++) {
var group = [], c;
for (var i = 0, compLen = completions.length; i < compLen; i++) {
c = completions[i];
if (c === "") {
handleGroup(group);
@ -230,7 +230,7 @@ function commonPrefix(strings) {
var sorted = strings.slice().sort();
var min = sorted[0];
var max = sorted[sorted.length - 1];
for (var i = 0; i < min.length; i++) {
for (var i = 0, len = min.length; i < len; i++) {
if (min[i] != max[i]) {
return min.slice(0, i);
}
@ -475,7 +475,7 @@ Interface.prototype._ttyWrite = function (b) {
default:
var c = b.toString('utf8');
var lines = c.split(/\r\n|\n|\r/);
for (var i = 0; i < lines.length; i++) {
for (var i = 0, len = lines.length; i < len; i++) {
if (i > 0) {
this._ttyWrite(new Buffer([13]));
}

Loading…
Cancel
Save