src: mark some global state as const
Mark some global variables as `const` or `constexpr`. PR-URL: https://github.com/nodejs/node/pull/25052 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
52ee55a06b
commit
18f2bf7f9b
@ -65,7 +65,7 @@ class TraceEventScope {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int const Environment::kNodeContextTag = 0x6e6f64;
|
int const Environment::kNodeContextTag = 0x6e6f64;
|
||||||
void* Environment::kNodeContextTagPtr = const_cast<void*>(
|
void* const Environment::kNodeContextTagPtr = const_cast<void*>(
|
||||||
static_cast<const void*>(&Environment::kNodeContextTag));
|
static_cast<const void*>(&Environment::kNodeContextTag));
|
||||||
|
|
||||||
IsolateData::IsolateData(Isolate* isolate,
|
IsolateData::IsolateData(Isolate* isolate,
|
||||||
|
@ -972,7 +972,7 @@ class Environment {
|
|||||||
uint64_t thread_id_ = 0;
|
uint64_t thread_id_ = 0;
|
||||||
std::unordered_set<worker::Worker*> sub_worker_contexts_;
|
std::unordered_set<worker::Worker*> sub_worker_contexts_;
|
||||||
|
|
||||||
static void* kNodeContextTagPtr;
|
static void* const kNodeContextTagPtr;
|
||||||
static int const kNodeContextTag;
|
static int const kNodeContextTag;
|
||||||
|
|
||||||
#if HAVE_INSPECTOR
|
#if HAVE_INSPECTOR
|
||||||
|
@ -81,9 +81,9 @@ using v8::Value;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __POSIX__
|
#ifdef __POSIX__
|
||||||
const char* kPathSeparator = "/";
|
constexpr char kPathSeparator = '/';
|
||||||
#else
|
#else
|
||||||
const char* kPathSeparator = "\\/";
|
const char* const kPathSeparator = "\\/";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GET_OFFSET(a) ((a)->IsNumber() ? (a).As<Integer>()->Value() : -1)
|
#define GET_OFFSET(a) ((a)->IsNumber() ? (a).As<Integer>()->Value() : -1)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
const char* llhttp_version =
|
const char* const llhttp_version =
|
||||||
NODE_STRINGIFY(LLHTTP_VERSION_MAJOR)
|
NODE_STRINGIFY(LLHTTP_VERSION_MAJOR)
|
||||||
"."
|
"."
|
||||||
NODE_STRINGIFY(LLHTTP_VERSION_MINOR)
|
NODE_STRINGIFY(LLHTTP_VERSION_MINOR)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
const char* http_parser_version =
|
const char* const http_parser_version =
|
||||||
NODE_STRINGIFY(HTTP_PARSER_VERSION_MAJOR)
|
NODE_STRINGIFY(HTTP_PARSER_VERSION_MAJOR)
|
||||||
"."
|
"."
|
||||||
NODE_STRINGIFY(HTTP_PARSER_VERSION_MINOR)
|
NODE_STRINGIFY(HTTP_PARSER_VERSION_MINOR)
|
||||||
|
@ -697,8 +697,8 @@ static inline const char* errno_string(int errorno) {
|
|||||||
|
|
||||||
extern double prog_start_time;
|
extern double prog_start_time;
|
||||||
|
|
||||||
extern const char* llhttp_version;
|
extern const char* const llhttp_version;
|
||||||
extern const char* http_parser_version;
|
extern const char* const http_parser_version;
|
||||||
|
|
||||||
void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
|
void Abort(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||||
void Chdir(const v8::FunctionCallbackInfo<v8::Value>& args);
|
void Chdir(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||||
|
@ -60,6 +60,6 @@ int GenDebugSymbols() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int debug_symbols_generated = GenDebugSymbols();
|
const int debug_symbols_generated = GenDebugSymbols();
|
||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user