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

ruby-changes:52015

From: akr <ko1@a...>
Date: Wed, 8 Aug 2018 21:49:03 +0900 (JST)
Subject: [ruby-changes:52015] akr:r64230 (trunk): rename several internal macros in time.c

akr	2018-08-08 21:48:58 +0900 (Wed, 08 Aug 2018)

  New Revision: 64230

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64230

  Log:
    rename several internal macros in time.c
    
    TIME_UTC_P -> TZMODE_UTC_P
    TIME_SET_UTC -> TZMODE_SET_UTC
    TIME_LOCALTIME_P -> TZMODE_LOCALTIME_P
    TIME_SET_LOCALTIME -> TZMODE_SET_LOCALTIME
    TIME_FIXOFF_P -> TZMODE_FIXOFF_P
    TIME_SET_FIXOFF -> TZMODE_SET_FIXOFF
    TIME_COPY_GMT -> TZMODE_COPY

  Modified files:
    trunk/time.c
Index: time.c
===================================================================
--- time.c	(revision 64229)
+++ time.c	(revision 64230)
@@ -1642,19 +1642,19 @@ PACKED_STRUCT_UNALIGNED(struct time_obje https://github.com/ruby/ruby/blob/trunk/time.c#L1642
 #define IsTimeval(obj) rb_typeddata_is_kind_of((obj), &time_data_type)
 #define TIME_INIT_P(tobj) ((tobj)->tzmode != TIME_TZMODE_UNINITIALIZED)
 
-#define TIME_UTC_P(tobj) ((tobj)->tzmode == TIME_TZMODE_UTC)
-#define TIME_SET_UTC(tobj) ((tobj)->tzmode = TIME_TZMODE_UTC)
+#define TZMODE_UTC_P(tobj) ((tobj)->tzmode == TIME_TZMODE_UTC)
+#define TZMODE_SET_UTC(tobj) ((tobj)->tzmode = TIME_TZMODE_UTC)
 
-#define TIME_LOCALTIME_P(tobj) ((tobj)->tzmode == TIME_TZMODE_LOCALTIME)
-#define TIME_SET_LOCALTIME(tobj) ((tobj)->tzmode = TIME_TZMODE_LOCALTIME)
+#define TZMODE_LOCALTIME_P(tobj) ((tobj)->tzmode == TIME_TZMODE_LOCALTIME)
+#define TZMODE_SET_LOCALTIME(tobj) ((tobj)->tzmode = TIME_TZMODE_LOCALTIME)
 
-#define TIME_FIXOFF_P(tobj) ((tobj)->tzmode == TIME_TZMODE_FIXOFF)
-#define TIME_SET_FIXOFF(tobj, off) \
+#define TZMODE_FIXOFF_P(tobj) ((tobj)->tzmode == TIME_TZMODE_FIXOFF)
+#define TZMODE_SET_FIXOFF(tobj, off) \
     ((tobj)->tzmode = TIME_TZMODE_FIXOFF, \
      (tobj)->vtm.utc_offset = (off), \
      (tobj)->vtm.zone = Qnil)
 
-#define TIME_COPY_GMT(tobj1, tobj2) \
+#define TZMODE_COPY(tobj1, tobj2) \
     ((tobj1)->tzmode = (tobj2)->tzmode, \
      (tobj1)->vtm.utc_offset = (tobj2)->vtm.utc_offset, \
      (tobj1)->vtm.zone = (tobj2)->vtm.zone)
@@ -1824,7 +1824,7 @@ time_set_utc_offset(VALUE time, VALUE of https://github.com/ruby/ruby/blob/trunk/time.c#L1824
     GetTimeval(time, tobj);
 
     tobj->tm_got = 0;
-    TIME_SET_FIXOFF(tobj, off);
+    TZMODE_SET_FIXOFF(tobj, off);
 
     return time;
 }
@@ -2218,13 +2218,13 @@ rb_time_timespec_new(const struct timesp https://github.com/ruby/ruby/blob/trunk/time.c#L2218
 
     if (-86400 < offset && offset <  86400) { /* fixoff */
 	GetTimeval(time, tobj);
-	TIME_SET_FIXOFF(tobj, INT2FIX(offset));
+	TZMODE_SET_FIXOFF(tobj, INT2FIX(offset));
     }
     else if (offset == INT_MAX) { /* localtime */
     }
     else if (offset == INT_MAX-1) { /* UTC */
 	GetTimeval(time, tobj);
-	TIME_SET_UTC(tobj);
+	TZMODE_SET_UTC(tobj);
     }
     else {
 	rb_raise(rb_eArgError, "utc_offset out of range");
@@ -2444,7 +2444,7 @@ time_s_at(int argc, VALUE *argv, VALUE k https://github.com/ruby/ruby/blob/trunk/time.c#L2444
         GetTimeval(time, tobj);
         t = time_new_timew(klass, tobj->timew);
 	GetTimeval(t, tobj2);
-        TIME_COPY_GMT(tobj2, tobj);
+        TZMODE_COPY(tobj2, tobj);
     }
     else {
         timew = rb_time_magnify(v2w(num_exact(time)));
@@ -3352,7 +3352,7 @@ time_utc_p(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3352
     struct time_object *tobj;
 
     GetTimeval(time, tobj);
-    if (TIME_UTC_P(tobj)) return Qtrue;
+    if (TZMODE_UTC_P(tobj)) return Qtrue;
     return Qfalse;
 }
 
@@ -3403,7 +3403,7 @@ time_localtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3403
     struct vtm vtm;
 
     GetTimeval(time, tobj);
-    if (TIME_LOCALTIME_P(tobj)) {
+    if (TZMODE_LOCALTIME_P(tobj)) {
 	if (tobj->tm_got)
 	    return time;
     }
@@ -3416,7 +3416,7 @@ time_localtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3416
     tobj->vtm = vtm;
 
     tobj->tm_got = 1;
-    TIME_SET_LOCALTIME(tobj);
+    TZMODE_SET_LOCALTIME(tobj);
     return time;
 }
 
@@ -3485,7 +3485,7 @@ time_gmtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3485
     struct vtm vtm;
 
     GetTimeval(time, tobj);
-    if (TIME_UTC_P(tobj)) {
+    if (TZMODE_UTC_P(tobj)) {
 	if (tobj->tm_got)
 	    return time;
     }
@@ -3498,7 +3498,7 @@ time_gmtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3498
     tobj->vtm = vtm;
 
     tobj->tm_got = 1;
-    TIME_SET_UTC(tobj);
+    TZMODE_SET_UTC(tobj);
     return time;
 }
 
@@ -3510,7 +3510,7 @@ time_fixoff(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3510
     VALUE off;
 
     GetTimeval(time, tobj);
-    if (TIME_FIXOFF_P(tobj)) {
+    if (TZMODE_FIXOFF_P(tobj)) {
        if (tobj->tm_got)
            return time;
     }
@@ -3518,7 +3518,7 @@ time_fixoff(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3518
        time_modify(time);
     }
 
-    if (TIME_FIXOFF_P(tobj))
+    if (TZMODE_FIXOFF_P(tobj))
         off = tobj->vtm.utc_offset;
     else
         off = INT2FIX(0);
@@ -3530,7 +3530,7 @@ time_fixoff(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3530
     vtm_add_offset(&tobj->vtm, off);
 
     tobj->tm_got = 1;
-    TIME_SET_FIXOFF(tobj, off);
+    TZMODE_SET_FIXOFF(tobj, off);
     return time;
 }
 
@@ -3603,8 +3603,8 @@ time_getgmtime(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3603
 static VALUE
 time_get_tm(VALUE time, struct time_object *tobj)
 {
-    if (TIME_UTC_P(tobj)) return time_gmtime(time);
-    if (TIME_FIXOFF_P(tobj)) return time_fixoff(time);
+    if (TZMODE_UTC_P(tobj)) return time_gmtime(time);
+    if (TZMODE_FIXOFF_P(tobj)) return time_fixoff(time);
     return time_localtime(time);
 }
 
@@ -3650,7 +3650,7 @@ time_to_s(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3650
     struct time_object *tobj;
 
     GetTimeval(time, tobj);
-    if (TIME_UTC_P(tobj))
+    if (TZMODE_UTC_P(tobj))
         return strftimev("%Y-%m-%d %H:%M:%S UTC", time, rb_usascii_encoding());
     else
         return strftimev("%Y-%m-%d %H:%M:%S %z", time, rb_usascii_encoding());
@@ -3665,14 +3665,14 @@ time_add(struct time_object *tobj, VALUE https://github.com/ruby/ruby/blob/trunk/time.c#L3665
         result = time_new_timew(rb_cTime, wsub(tobj->timew, rb_time_magnify(v2w(offset))));
     else
         result = time_new_timew(rb_cTime, wadd(tobj->timew, rb_time_magnify(v2w(offset))));
-    if (TIME_UTC_P(tobj)) {
+    if (TZMODE_UTC_P(tobj)) {
 	GetTimeval(result, tobj);
-        TIME_SET_UTC(tobj);
+        TZMODE_SET_UTC(tobj);
     }
-    else if (TIME_FIXOFF_P(tobj)) {
+    else if (TZMODE_FIXOFF_P(tobj)) {
         VALUE off = tobj->vtm.utc_offset;
         GetTimeval(result, tobj);
-        TIME_SET_FIXOFF(tobj, off);
+        TZMODE_SET_FIXOFF(tobj, off);
     }
 
     return result;
@@ -3756,7 +3756,7 @@ rb_time_succ(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L3756
     GetTimeval(time, tobj);
     time = time_new_timew(rb_cTime, wadd(tobj->timew, WINT2FIXWV(TIME_SCALE)));
     GetTimeval(time, tobj2);
-    TIME_COPY_GMT(tobj2, tobj);
+    TZMODE_COPY(tobj2, tobj);
     return time;
 }
 
@@ -4187,7 +4187,7 @@ time_zone(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L4187
     GetTimeval(time, tobj);
     MAKE_TM(time, tobj);
 
-    if (TIME_UTC_P(tobj)) {
+    if (TZMODE_UTC_P(tobj)) {
 	return rb_usascii_str_new_cstr("UTC");
     }
     if (tobj->vtm.zone == Qnil)
@@ -4218,7 +4218,7 @@ rb_time_utc_offset(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L4218
 
     GetTimeval(time, tobj);
 
-    if (TIME_UTC_P(tobj)) {
+    if (TZMODE_UTC_P(tobj)) {
 	return INT2FIX(0);
     }
     else {
@@ -4290,7 +4290,7 @@ strftime_cstr(const char *fmt, size_t le https://github.com/ruby/ruby/blob/trunk/time.c#L4290
 
     GetTimeval(time, tobj);
     MAKE_TM(time, tobj);
-    str = rb_strftime_alloc(fmt, len, enc, &tobj->vtm, tobj->timew, TIME_UTC_P(tobj));
+    str = rb_strftime_alloc(fmt, len, enc, &tobj->vtm, tobj->timew, TZMODE_UTC_P(tobj));
     if (!str) rb_raise(rb_eArgError, "invalid format: %s", fmt);
     return str;
 }
@@ -4507,7 +4507,7 @@ time_strftime(VALUE time, VALUE format) https://github.com/ruby/ruby/blob/trunk/time.c#L4507
     }
     else {
 	VALUE str = rb_strftime_alloc(fmt, len, enc, &tobj->vtm, tobj->timew,
-				      TIME_UTC_P(tobj));
+				      TZMODE_UTC_P(tobj));
 	rb_str_tmp_frozen_release(format, tmp);
 	if (!str) rb_raise(rb_eArgError, "invalid format: %"PRIsVALUE, format);
 	return str;
@@ -4553,7 +4553,7 @@ time_mdump(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L4553
     nano = addv(LONG2FIX(nsec), subnano);
 
     p = 0x1UL            << 31 | /*  1 */
-	TIME_UTC_P(tobj) << 30 | /*  1 */
+	TZMODE_UTC_P(tobj) << 30 | /*  1 */
 	(year-1900)      << 14 | /* 16 */
 	(vtm.mon-1)      << 10 | /*  4 */
 	vtm.mday         <<  5 | /*  5 */
@@ -4602,7 +4602,7 @@ time_mdump(VALUE time) https://github.com/ruby/ruby/blob/trunk/time.c#L4602
             len = 1;
         rb_ivar_set(str, id_submicro, rb_str_new(buf, len));
     }
-    if (!TIME_UTC_P(tobj)) {
+    if (!TZMODE_UTC_P(tobj)) {
 	VALUE off = rb_time_utc_offset(time), div, mod;
 	divmodv(off, INT2FIX(1), &div, &mod);
 	if (rb_equal(mod, INT2FIX(0)))
@@ -4732,14 +4732,14 @@ end_submicro: ; https://github.com/ruby/ruby/blob/trunk/time.c#L4732
     tobj->tm_got = 0;
     tobj->timew = timew;
     if (gmt) {
-	TIME_SET_UTC(tobj);
+	TZMODE_SET_UTC(tobj);
     }
     else if (!NIL_P(offset)) {
 	time_set_utc_offset(time, offset);
 	time_fixoff(time);
     }
     if (!NIL_P(zone)) {
-	if (TIME_FIXOFF_P(tobj)) TIME_SET_LOCALTIME(tobj);
+	if (TZMODE_FIXOFF_P(tobj)) TZMODE_SET_LOCALTIME(tobj);
 	zone = rb_fstring(zone);
 	tobj->vtm.zone = zone;
     }

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

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