Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make Socket.write optimizable

  • Loading branch information...
commit a73384ed29d1815e587612626737c06b3e7d143e 1 parent 6ed8d41
@piscisaureus piscisaureus authored
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/net.js
View
32 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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.