diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 14b2dad9376c9a..989cf2d96a30cb 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -355,16 +355,16 @@ void SecureContext::Initialize(Environment* env, Local target) { env->SetProtoMethodNoSideEffect(t, "getCertificate", GetCertificate); env->SetProtoMethodNoSideEffect(t, "getIssuer", GetCertificate); - t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyReturnIndex"), - Integer::NewFromUnsigned(env->isolate(), kTicketKeyReturnIndex)); - t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyHMACIndex"), - Integer::NewFromUnsigned(env->isolate(), kTicketKeyHMACIndex)); - t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyAESIndex"), - Integer::NewFromUnsigned(env->isolate(), kTicketKeyAESIndex)); - t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyNameIndex"), - Integer::NewFromUnsigned(env->isolate(), kTicketKeyNameIndex)); - t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"), - Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex)); +#define SET_INTEGER_CONSTANTS(name, value) \ + t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), name), \ + Integer::NewFromUnsigned(env->isolate(), value)); + SET_INTEGER_CONSTANTS("kTicketKeyReturnIndex", kTicketKeyReturnIndex); + SET_INTEGER_CONSTANTS("kTicketKeyHMACIndex", kTicketKeyHMACIndex); + SET_INTEGER_CONSTANTS("kTicketKeyAESIndex", kTicketKeyAESIndex); + SET_INTEGER_CONSTANTS("kTicketKeyNameIndex", kTicketKeyNameIndex); + SET_INTEGER_CONSTANTS("kTicketKeyIVIndex", kTicketKeyIVIndex); + +#undef SET_INTEGER_CONSTANTS Local ctx_getter_templ = FunctionTemplate::New(env->isolate(),