diff options
author | James M Snell <jasnell@gmail.com> | 2020-02-26 01:37:33 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-03-05 00:30:03 +0300 |
commit | 4d5318c16467623770bb77f7ecac720cb93b0326 (patch) | |
tree | e8ab0642e7b87beb91a63eeafa33a3b547f3cd28 /src/cares_wrap.cc | |
parent | 0fc45f80b59db586c46d8b0fca265446a46ed121 (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.cc | 3 |
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>); |