aboutsummaryrefslogtreecommitdiff
path: root/lib/_tls_legacy.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-07-24 18:03:53 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-07-24 21:49:35 +0200
commit0330bdf5195eb77f04c26a09a8bd2088a261fe53 (patch)
tree2c13f9f1757bca93e83e425a028dcae78549f40e /lib/_tls_legacy.js
parent457d52924152c6f2baf2fddbe76a03bca7bdde7c (diff)
downloadandroid-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.tar.gz
android-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.tar.bz2
android-node-v8-0330bdf5195eb77f04c26a09a8bd2088a261fe53.zip
lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks across the code base.
Diffstat (limited to 'lib/_tls_legacy.js')
-rw-r--r--lib/_tls_legacy.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/_tls_legacy.js b/lib/_tls_legacy.js
index 4acabe3937..6c85251c1d 100644
--- a/lib/_tls_legacy.js
+++ b/lib/_tls_legacy.js
@@ -36,7 +36,7 @@ SlabBuffer.prototype.use = function use(context, fn, size) {
var actualSize = this.remaining;
- if (size !== null) actualSize = Math.min(size, actualSize);
+ if (!IS_NULL(size)) actualSize = Math.min(size, actualSize);
var bytes = fn.call(context, this.pool, this.offset, actualSize);
if (bytes > 0) {
@@ -72,7 +72,7 @@ function CryptoStream(pair, options) {
this._finished = false;
this._opposite = null;
- if (slabBuffer === null) slabBuffer = new SlabBuffer();
+ if (IS_NULL(slabBuffer)) slabBuffer = new SlabBuffer();
this._buffer = slabBuffer;
this.once('finish', onCryptoStreamFinish);
@@ -144,7 +144,7 @@ CryptoStream.prototype.init = function init() {
CryptoStream.prototype._write = function write(data, encoding, cb) {
- assert(this._pending === null);
+ assert(IS_NULL(this._pending));
// Black-hole data
if (!this.pair.ssl) return cb(null);
@@ -191,7 +191,7 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
// Invoke callback only when all data read from opposite stream
if (this._opposite._halfRead) {
- assert(this._sslOutCb === null);
+ assert(IS_NULL(this._sslOutCb));
this._sslOutCb = cb;
} else {
cb(null);
@@ -285,8 +285,8 @@ CryptoStream.prototype._read = function read(size) {
}
// Try writing pending data
- if (this._pending !== null) this._writePending();
- if (this._opposite._pending !== null) this._opposite._writePending();
+ if (!IS_NULL(this._pending)) this._writePending();
+ if (!IS_NULL(this._opposite._pending)) this._opposite._writePending();
if (bytesRead === 0) {
// EOF when cleartext has finished and we have nothing to read
@@ -405,7 +405,7 @@ CryptoStream.prototype.end = function(chunk, encoding) {
}
// Write pending data first
- if (this._pending !== null) this._writePending();
+ if (!IS_NULL(this._pending)) this._writePending();
this.writable = false;