Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Make Socket.write optimizable

  • Loading branch information...
piscisaureus committed Oct 12, 2011
1 parent 6ed8d41 commit a73384ed29d1815e587612626737c06b3e7d143e
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/net.js
@@ -342,29 +342,29 @@ Socket.prototype.setEncoding = function(encoding) {
};


Socket.prototype.write = function(data /* [encoding], [fd], [cb] */) {
Socket.prototype.write = function(data, arg1, arg2, arg3) {
var encoding, fd, cb;

// parse arguments
if (typeof arguments[3] == 'function') {
cb = arguments[3];
fd = arguments[2];
encoding = arguments[1];
} else if (typeof arguments[2] == 'function') {
cb = arguments[2];
if (typeof arguments[1] == 'number') {
fd = arguments[1];
if (typeof arg3 == 'function') {
cb = arg3;
fd = arg2;
encoding = arg1;
} else if (typeof arg2 == 'function') {
cb = arg2;
if (typeof arg1 == 'number') {
fd = arg1;
} else {
encoding = arguments[1];
encoding = arg1;
}
} else if (typeof arguments[1] == 'function') {
cb = arguments[1];
} else if (typeof arg1 == 'function') {
cb = arg1;
} else {
if (typeof arguments[1] == 'number') {
fd = arguments[1];
if (typeof arg1 == 'number') {
fd = arg1;
} else {
encoding = arguments[1];
fd = arguments[2];
encoding = arg1;
fd = arg2;
}
}

0 comments on commit a73384e

Please sign in to comment.
You can’t perform that action at this time.