diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2016-03-31 12:47:06 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2016-04-05 11:37:02 +0200 |
commit | a7581d0859ce5139b2d7795c5ac1f8df0e85815c (patch) | |
tree | eeb93d30f9690d1ee6e96a46685574aeba25ca9d /src/stream_base.cc | |
parent | 00c876dec54f9c515aeed78c75ce61a4e0206d95 (diff) | |
download | node-new-a7581d0859ce5139b2d7795c5ac1f8df0e85815c.tar.gz |
src: replace ARRAY_SIZE with typesafe arraysize
To prevent `ARRAY_SIZE(&arg)` (i.e., taking the array size of a pointer)
from happening again.
PR-URL: https://github.com/nodejs/node/pull/5969
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/stream_base.cc')
-rw-r--r-- | src/stream_base.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stream_base.cc b/src/stream_base.cc index 648c6d3aa5..7561a09998 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -84,7 +84,7 @@ void StreamBase::AfterShutdown(ShutdownWrap* req_wrap, int status) { if (req_wrap->object()->Has(env->context(), env->oncomplete_string()).FromJust()) { - req_wrap->MakeCallback(env->oncomplete_string(), ARRAY_SIZE(argv), argv); + req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); } delete req_wrap; @@ -132,7 +132,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) { if (storage_size > INT_MAX) return UV_ENOBUFS; - if (ARRAY_SIZE(bufs_) < count) + if (arraysize(bufs_) < count) bufs = new uv_buf_t[count]; WriteWrap* req_wrap = WriteWrap::New(env, @@ -391,7 +391,7 @@ void StreamBase::AfterWrite(WriteWrap* req_wrap, int status) { if (req_wrap->object()->Has(env->context(), env->oncomplete_string()).FromJust()) { - req_wrap->MakeCallback(env->oncomplete_string(), ARRAY_SIZE(argv), argv); + req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); } req_wrap->Dispose(); @@ -420,10 +420,10 @@ void StreamBase::EmitData(ssize_t nread, node::MakeCallback(env, GetObject(), env->onread_string(), - ARRAY_SIZE(argv), + arraysize(argv), argv); } else { - async->MakeCallback(env->onread_string(), ARRAY_SIZE(argv), argv); + async->MakeCallback(env->onread_string(), arraysize(argv), argv); } } |