[前][次][番号順一覧][スレッド一覧]

ruby-changes:60829

From: Nobuyoshi <ko1@a...>
Date: Sun, 19 Apr 2020 00:35:20 +0900 (JST)
Subject: [ruby-changes:60829] ec4e57cae0 (master): Hoisted out reset_by_modified_env

https://git.ruby-lang.org/ruby.git/commit/?id=ec4e57cae0

From ec4e57cae0cc9fede7f7809f8e443cd811ebddb4 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 18 Apr 2020 20:58:35 +0900
Subject: Hoisted out reset_by_modified_env


diff --git a/hash.c b/hash.c
index 71bbfea..8626101 100644
--- a/hash.c
+++ b/hash.c
@@ -4881,14 +4881,9 @@ env_name(volatile VALUE *s) https://github.com/ruby/ruby/blob/trunk/hash.c#L4881
 
 static VALUE env_aset(VALUE nm, VALUE val);
 
-static VALUE
-env_delete(VALUE name)
+static void
+reset_by_modified_env(const char *nam)
 {
-    const char *nam, *val;
-
-    nam = env_name(name);
-    val = getenv(nam);
-
     /*
      * ENV['TZ'] = nil has a special meaning.
      * TZ is no longer considered up-to-date and ruby call tzset() as needed.
@@ -4898,6 +4893,15 @@ env_delete(VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4893
     if (ENVMATCH(nam, TZ_ENV)) {
         ruby_reset_timezone();
     }
+}
+
+static VALUE
+env_delete(VALUE name)
+{
+    const char *nam = env_name(name);
+    const char *val = getenv(nam);
+
+    reset_by_modified_env(nam);
 
     if (val) {
 	VALUE value = env_str_new2(val);
@@ -5327,9 +5331,7 @@ env_aset(VALUE nm, VALUE val) https://github.com/ruby/ruby/blob/trunk/hash.c#L5331
     if (ENVMATCH(name, PATH_ENV)) {
 	RB_GC_GUARD(nm);
     }
-    else if (ENVMATCH(name, TZ_ENV)) {
-        ruby_reset_timezone();
-    }
+    reset_by_modified_env(name);
     return val;
 }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]