summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2023-05-10 15:20:04 +0200
committerMichaël Zasso <targos@protonmail.com>2023-05-12 11:57:21 +0200
commitbd553e7521b491e64d52b0f492066e84c4e433a6 (patch)
tree9f6c61aa08d7615a002ee42eab1704295d19f178
parentb16f6da1533e861007874fb1a05ed76fa3a6a513 (diff)
downloadnode-new-bd553e7521b491e64d52b0f492066e84c4e433a6.tar.gz
src: rename SKIP_CHECK_SIZE to SKIP_CHECK_STRLEN
SKIP_CHECK_VALUE is a string literal, so its size is the length of the string in chars plus one. The buffer buf is also always null-terminated, so its size should match the size of SKIP_CHECK_VALUE, which is _not_ SKIP_CHECK_SIZE. Rename SKIP_CHECK_SIZE to be consistent with C/C++ terminology. PR-URL: https://github.com/nodejs/node/pull/47845 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
-rw-r--r--src/node_main.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/node_main.cc b/src/node_main.cc
index 56deaf47fa..f66099a557 100644
--- a/src/node_main.cc
+++ b/src/node_main.cc
@@ -28,18 +28,18 @@
#include <WinError.h>
#define SKIP_CHECK_VAR "NODE_SKIP_PLATFORM_CHECK"
-#define SKIP_CHECK_SIZE 1
#define SKIP_CHECK_VALUE "1"
+#define SKIP_CHECK_STRLEN (sizeof(SKIP_CHECK_VALUE) - 1)
int wmain(int argc, wchar_t* wargv[]) {
// Windows Server 2012 (not R2) is supported until 10/10/2023, so we allow it
// to run in the experimental support tier.
- char buf[SKIP_CHECK_SIZE + 1];
+ char buf[SKIP_CHECK_STRLEN + 1];
if (!IsWindows8Point1OrGreater() &&
!(IsWindowsServer() && IsWindows8OrGreater()) &&
(GetEnvironmentVariableA(SKIP_CHECK_VAR, buf, sizeof(buf)) !=
- SKIP_CHECK_SIZE ||
- strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_SIZE + 1) != 0)) {
+ SKIP_CHECK_STRLEN ||
+ strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_STRLEN) != 0)) {
fprintf(stderr, "Node.js is only supported on Windows 8.1, Windows "
"Server 2012 R2, or higher.\n"
"Setting the " SKIP_CHECK_VAR " environment variable "