Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-02-26 01:37:33 +0300
committerJames M Snell <jasnell@gmail.com>2020-03-02 21:58:36 +0300
commit0fac393d263fc7e2f4f054c9d4aab0c1c3cf00c8 (patch)
treef11f3380bc282709feed38b957e38ad3adf2a4a5 /src/cares_wrap.cc
parent68e36ade3de2205c583f2cc6a2d2ec192b75cc95 (diff)
src: improve handling of internal field counting
Change suggested by bnoordhuis. Improve handing of internal field counting by using enums. Helps protect against future possible breakage if field indexes are ever changed or added to. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/31960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r--src/cares_wrap.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index 8eeaeddf830..8abf662caa3 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -2223,7 +2223,8 @@ void Initialize(Local<Object> target,
Local<FunctionTemplate> channel_wrap =
env->NewFunctionTemplate(ChannelWrap::New);
- channel_wrap->InstanceTemplate()->SetInternalFieldCount(1);
+ channel_wrap->InstanceTemplate()->SetInternalFieldCount(
+ ChannelWrap::kInternalFieldCount);
channel_wrap->Inherit(AsyncWrap::GetConstructorTemplate(env));
env->SetProtoMethod(channel_wrap, "queryAny", Query<QueryAnyWrap>);