Skip to content

Commit

Permalink
src: refactor using-declarations node_env_var.cc
Browse files Browse the repository at this point in the history
PR-URL: #36128
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
RaisinTen authored and BethGriggs committed Dec 15, 2020
1 parent 75e49b8 commit 5c81a10
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/node_env_var.cc
Expand Up @@ -9,6 +9,8 @@ namespace node {
using v8::Array;
using v8::Boolean;
using v8::Context;
using v8::DontDelete;
using v8::DontEnum;
using v8::EscapableHandleScope;
using v8::HandleScope;
using v8::Integer;
Expand All @@ -25,6 +27,7 @@ using v8::Object;
using v8::ObjectTemplate;
using v8::PropertyCallbackInfo;
using v8::PropertyHandlerFlags;
using v8::ReadOnly;
using v8::String;
using v8::Value;

Expand Down Expand Up @@ -92,10 +95,10 @@ Maybe<std::string> RealEnvStore::Get(const char* key) const {
}

if (ret >= 0) { // Env key value fetch success.
return v8::Just(std::string(*val, init_sz));
return Just(std::string(*val, init_sz));
}

return v8::Nothing<std::string>();
return Nothing<std::string>();
}

MaybeLocal<String> RealEnvStore::Get(Isolate* isolate,
Expand Down Expand Up @@ -140,9 +143,9 @@ int32_t RealEnvStore::Query(const char* key) const {

#ifdef _WIN32
if (key[0] == '=') {
return static_cast<int32_t>(v8::ReadOnly) |
static_cast<int32_t>(v8::DontDelete) |
static_cast<int32_t>(v8::DontEnum);
return static_cast<int32_t>(ReadOnly) |
static_cast<int32_t>(DontDelete) |
static_cast<int32_t>(DontEnum);
}
#endif

Expand Down Expand Up @@ -190,7 +193,7 @@ Local<Array> RealEnvStore::Enumerate(Isolate* isolate) const {
return Array::New(isolate, env_v.out(), env_v_index);
}

std::shared_ptr<KVStore> KVStore::Clone(v8::Isolate* isolate) const {
std::shared_ptr<KVStore> KVStore::Clone(Isolate* isolate) const {
HandleScope handle_scope(isolate);
Local<Context> context = isolate->GetCurrentContext();

Expand All @@ -210,7 +213,7 @@ std::shared_ptr<KVStore> KVStore::Clone(v8::Isolate* isolate) const {
Maybe<std::string> MapKVStore::Get(const char* key) const {
Mutex::ScopedLock lock(mutex_);
auto it = map_.find(key);
return it == map_.end() ? v8::Nothing<std::string>() : v8::Just(it->second);
return it == map_.end() ? Nothing<std::string>() : Just(it->second);
}

MaybeLocal<String> MapKVStore::Get(Isolate* isolate, Local<String> key) const {
Expand Down

0 comments on commit 5c81a10

Please sign in to comment.