Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: mark some global state as const #25052

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/env.cc
Expand Up @@ -65,7 +65,7 @@ class TraceEventScope {
};

int const Environment::kNodeContextTag = 0x6e6f64;
void* Environment::kNodeContextTagPtr = const_cast<void*>(
void* const Environment::kNodeContextTagPtr = const_cast<void*>(
static_cast<const void*>(&Environment::kNodeContextTag));

IsolateData::IsolateData(Isolate* isolate,
Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Expand Up @@ -972,7 +972,7 @@ class Environment {
uint64_t thread_id_ = 0;
std::unordered_set<worker::Worker*> sub_worker_contexts_;

static void* kNodeContextTagPtr;
static void* const kNodeContextTagPtr;
static int const kNodeContextTag;

#if HAVE_INSPECTOR
Expand Down
4 changes: 2 additions & 2 deletions src/node_file.cc
Expand Up @@ -81,9 +81,9 @@ using v8::Value;
#endif

#ifdef __POSIX__
const char* kPathSeparator = "/";
constexpr char kPathSeparator = '/';
#else
const char* kPathSeparator = "\\/";
constexpr char kPathSeparator = '\\/';
addaleax marked this conversation as resolved.
Show resolved Hide resolved
#endif

#define GET_OFFSET(a) ((a)->IsNumber() ? (a).As<Integer>()->Value() : -1)
Expand Down
2 changes: 1 addition & 1 deletion src/node_http_parser_llhttp.cc
Expand Up @@ -4,7 +4,7 @@

namespace node {

const char* llhttp_version =
const char* const llhttp_version =
NODE_STRINGIFY(LLHTTP_VERSION_MAJOR)
"."
NODE_STRINGIFY(LLHTTP_VERSION_MINOR)
Expand Down
2 changes: 1 addition & 1 deletion src/node_http_parser_traditional.cc
Expand Up @@ -6,7 +6,7 @@

namespace node {

const char* http_parser_version =
const char* const http_parser_version =
NODE_STRINGIFY(HTTP_PARSER_VERSION_MAJOR)
"."
NODE_STRINGIFY(HTTP_PARSER_VERSION_MINOR)
Expand Down
4 changes: 2 additions & 2 deletions src/node_internals.h
Expand Up @@ -697,8 +697,8 @@ static inline const char* errno_string(int errorno) {

extern double prog_start_time;

extern const char* llhttp_version;
extern const char* http_parser_version;
extern const char* const llhttp_version;
extern const char* const http_parser_version;

void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
void Chdir(const v8::FunctionCallbackInfo<v8::Value>& args);
Expand Down
2 changes: 1 addition & 1 deletion src/node_postmortem_metadata.cc
Expand Up @@ -60,6 +60,6 @@ int GenDebugSymbols() {
return 1;
}

int debug_symbols_generated = GenDebugSymbols();
const int debug_symbols_generated = GenDebugSymbols();

} // namespace node