GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: env_vars caching and local variable scope optimization · nodejs/node@0d761bb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_dotenv.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_dotenv.cc‎

Copy file name to clipboardExpand all lines: src/node_dotenv.cc
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,19 @@ std::vector<Dotenv::env_file_data> Dotenv::GetDataFromArgs(
6565
}
6666

6767
Maybe<void> Dotenv::SetEnvironment(node::Environment* env) {
68-
Local<Value> name;
69-
Local<Value> val;
7068
auto context = env->context();
69+
auto env_vars = env->env_vars();
7170

7271
for (const auto& entry : store_) {
73-
auto existing = env->env_vars()->Get(entry.first.data());
72+
auto existing = env_vars->Get(entry.first.data());
7473
if (!existing.has_value()) {
74+
Local<Value> name;
75+
Local<Value> val;
7576
if (!ToV8Value(context, entry.first).ToLocal(&name) ||
7677
!ToV8Value(context, entry.second).ToLocal(&val)) {
7778
return Nothing<void>();
7879
}
79-
env->env_vars()->Set(env->isolate(), name.As<String>(), val.As<String>());
80+
env_vars->Set(env->isolate(), name.As<String>(), val.As<String>());
8081
}
8182
}
8283

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.