Skip to content

Commit

Permalink
Make Socket.write optimizable
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Oct 12, 2011
1 parent 6ed8d41 commit a73384e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/net.js
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit a73384e

Please sign in to comment.