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

ruby-changes:59857

From: Tanaka <ko1@a...>
Date: Wed, 29 Jan 2020 00:02:36 +0900 (JST)
Subject: [ruby-changes:59857] 338c5b8c1d (master): Extract a function, ruby_reset_timezone().

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

From 338c5b8c1dc061e9f8d21f6d9f5ac053c4497383 Mon Sep 17 00:00:00 2001
From: Tanaka Akira <akr@f...>
Date: Tue, 28 Jan 2020 23:40:25 +0900
Subject: Extract a function, ruby_reset_timezone().

Initial implementation of ruby_reset_timezone()
assigns ruby_tz_uptodate_p to false.

diff --git a/hash.c b/hash.c
index 32df430..8eb07a5 100644
--- a/hash.c
+++ b/hash.c
@@ -35,6 +35,7 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L35
 #include "internal/object.h"
 #include "internal/proc.h"
 #include "internal/symbol.h"
+#include "internal/time.h"
 #include "internal/vm.h"
 #include "probes.h"
 #include "ruby/st.h"
@@ -4758,7 +4759,6 @@ env_str_new2(const char *ptr) https://github.com/ruby/ruby/blob/trunk/hash.c#L4759
 }
 
 static const char TZ_ENV[] = "TZ";
-extern bool ruby_tz_uptodate_p;
 
 static rb_encoding *
 env_encoding_for(const char *name, const char *ptr)
@@ -4843,7 +4843,7 @@ env_delete(VALUE name) https://github.com/ruby/ruby/blob/trunk/hash.c#L4843
      * This hack might works only on Linux glibc.
      */
     if (ENVMATCH(nam, TZ_ENV)) {
-        ruby_tz_uptodate_p = FALSE;
+        ruby_reset_timezone();
     }
 
     if (val) {
@@ -5275,7 +5275,7 @@ env_aset(VALUE nm, VALUE val) https://github.com/ruby/ruby/blob/trunk/hash.c#L5275
 	RB_GC_GUARD(nm);
     }
     else if (ENVMATCH(name, TZ_ENV)) {
-	ruby_tz_uptodate_p = FALSE;
+        ruby_reset_timezone();
     }
     return val;
 }
diff --git a/internal/time.h b/internal/time.h
index ef3d64e..8f84899 100644
--- a/internal/time.h
+++ b/internal/time.h
@@ -29,6 +29,7 @@ struct timeval rb_time_timeval(VALUE); https://github.com/ruby/ruby/blob/trunk/internal/time.h#L29
 RUBY_SYMBOL_EXPORT_BEGIN
 /* time.c (export) */
 void ruby_reset_leap_second_info(void);
+void ruby_reset_timezone(void);
 RUBY_SYMBOL_EXPORT_END
 
 #endif /* INTERNAL_TIME_H */
diff --git a/time.c b/time.c
index b5d1aee..7339547 100644
--- a/time.c
+++ b/time.c
@@ -683,6 +683,12 @@ static VALUE tm_from_time(VALUE klass, VALUE time); https://github.com/ruby/ruby/blob/trunk/time.c#L683
 
 bool ruby_tz_uptodate_p;
 
+void
+ruby_reset_timezone(void)
+{
+    ruby_tz_uptodate_p = false;
+}
+
 static void
 update_tz(void)
 {
-- 
cgit v0.10.2


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

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