summaryrefslogtreecommitdiff
path: root/src/udp_wrap.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-02-25 14:37:33 -0800
committerJames M Snell <jasnell@gmail.com>2020-03-02 10:58:36 -0800
commit0fac393d263fc7e2f4f054c9d4aab0c1c3cf00c8 (patch)
treef11f3380bc282709feed38b957e38ad3adf2a4a5 /src/udp_wrap.cc
parent68e36ade3de2205c583f2cc6a2d2ec192b75cc95 (diff)
downloadnode-new-0fac393d263fc7e2f4f054c9d4aab0c1c3cf00c8.tar.gz
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/udp_wrap.cc')
-rw-r--r--src/udp_wrap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index 4a66ce0a1f..fa5cf8da47 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -91,7 +91,7 @@ void UDPWrap::Initialize(Local<Object> target,
Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
- t->InstanceTemplate()->SetInternalFieldCount(1);
+ t->InstanceTemplate()->SetInternalFieldCount(UDPWrap::kInternalFieldCount);
Local<String> udpString =
FIXED_ONE_BYTE_STRING(env->isolate(), "UDP");
t->SetClassName(udpString);