Skip to content

Commit bd553e7

Browse files
tniessentargos
authored andcommitted
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: #47845 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
1 parent b16f6da commit bd553e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/node_main.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
#include <WinError.h>
2929

3030
#define SKIP_CHECK_VAR "NODE_SKIP_PLATFORM_CHECK"
31-
#define SKIP_CHECK_SIZE 1
3231
#define SKIP_CHECK_VALUE "1"
32+
#define SKIP_CHECK_STRLEN (sizeof(SKIP_CHECK_VALUE) - 1)
3333

3434
int wmain(int argc, wchar_t* wargv[]) {
3535
// Windows Server 2012 (not R2) is supported until 10/10/2023, so we allow it
3636
// to run in the experimental support tier.
37-
char buf[SKIP_CHECK_SIZE + 1];
37+
char buf[SKIP_CHECK_STRLEN + 1];
3838
if (!IsWindows8Point1OrGreater() &&
3939
!(IsWindowsServer() && IsWindows8OrGreater()) &&
4040
(GetEnvironmentVariableA(SKIP_CHECK_VAR, buf, sizeof(buf)) !=
41-
SKIP_CHECK_SIZE ||
42-
strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_SIZE + 1) != 0)) {
41+
SKIP_CHECK_STRLEN ||
42+
strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_STRLEN) != 0)) {
4343
fprintf(stderr, "Node.js is only supported on Windows 8.1, Windows "
4444
"Server 2012 R2, or higher.\n"
4545
"Setting the " SKIP_CHECK_VAR " environment variable "

0 commit comments

Comments
 (0)