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. 8
      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 // Merge optionArg into options
if (optionArg) { if (optionArg) {
var keys = Object.keys(options); 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]; var k = keys[i];
if (optionArg[k] !== undefined) options[k] = optionArg[k]; if (optionArg[k] !== undefined) options[k] = optionArg[k];
} }

4
lib/crypto.js

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

8
lib/dns.js

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

10
lib/readline.js

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

Loading…
Cancel
Save