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

ruby-changes:53480

From: nobu <ko1@a...>
Date: Tue, 13 Nov 2018 13:29:35 +0900 (JST)
Subject: [ruby-changes:53480] nobu:r65696 (trunk): date_core.c: set/reset COMPLEX_DAT

nobu	2018-11-13 13:29:29 +0900 (Tue, 13 Nov 2018)

  New Revision: 65696

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

  Log:
    date_core.c: set/reset COMPLEX_DAT
    
    * ext/date/date_core.c (set_to_simple, set_to_complex): always
      set/reset COMPLEX_DAT bit, which is very tightly bound to the
      structure.

  Modified files:
    trunk/ext/date/date_core.c
Index: ext/date/date_core.c
===================================================================
--- ext/date/date_core.c	(revision 65695)
+++ ext/date/date_core.c	(revision 65696)
@@ -322,7 +322,7 @@ do {\ https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L322
     (x)->year = _year;\
     (x)->mon = _mon;\
     (x)->mday = _mday;\
-    (x)->flags = _flags;\
+    (x)->flags = (_flags) & ~COMPLEX_DAT;\
 } while (0)
 #else
 #define set_to_simple(obj, x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \
@@ -332,7 +332,7 @@ do {\ https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L332
     (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->pc = PACK2(_mon, _mday);\
-    (x)->flags = _flags;\
+    (x)->flags = (_flags) & ~COMPLEX_DAT;\
 } while (0)
 #endif
 
@@ -352,7 +352,7 @@ do {\ https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L352
     (x)->hour = _hour;\
     (x)->min = _min;\
     (x)->sec = _sec;\
-    (x)->flags = _flags;\
+    (x)->flags = (_flags) | COMPLEX_DAT;\
 } while (0)
 #else
 #define set_to_complex(obj, x, _nth, _jd ,_df, _sf, _of, _sg,\
@@ -366,7 +366,7 @@ do {\ https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L366
     (x)->sg = (date_sg_t)(_sg);\
     (x)->year = _year;\
     (x)->pc = PACK5(_mon, _mday, _hour, _min, _sec);\
-    (x)->flags = _flags;\
+    (x)->flags = (_flags) | COMPLEX_DAT;\
 } while (0)
 #endif
 
@@ -2966,7 +2966,7 @@ d_simple_new_internal(VALUE klass, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2966
 
     obj = TypedData_Make_Struct(klass, struct SimpleDateData,
 				&d_lite_type, dat);
-    set_to_simple(obj, dat, nth, jd, sg, y, m, d, flags & ~COMPLEX_DAT);
+    set_to_simple(obj, dat, nth, jd, sg, y, m, d, flags);
 
     assert(have_jd_p(dat) || have_civil_p(dat));
 
@@ -2988,7 +2988,7 @@ d_complex_new_internal(VALUE klass, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2988
     obj = TypedData_Make_Struct(klass, struct ComplexDateData,
 				&d_lite_type, dat);
     set_to_complex(obj, dat, nth, jd, df, sf, of, sg,
-		   y, m, d, h, min, s, flags | COMPLEX_DAT);
+		   y, m, d, h, min, s, flags);
 
     assert(have_jd_p(dat) || have_civil_p(dat));
     assert(have_df_p(dat) || have_time_p(dat));
@@ -4749,7 +4749,7 @@ d_lite_initialize(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4749
 			 "cannot load complex into simple");
 
 	    set_to_complex(self, &dat->c, nth, rjd, df, sf, of, sg,
-			   0, 0, 0, 0, 0, 0, HAVE_JD | HAVE_DF | COMPLEX_DAT);
+			   0, 0, 0, 0, 0, 0, HAVE_JD | HAVE_DF);
 	}
     }
     return self;
@@ -7144,7 +7144,7 @@ d_lite_marshal_load(VALUE self, VALUE a) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L7144
 
 		set_to_complex(self, &dat->c, nth, jd, df, sf, rof, rsg,
 			       0, 0, 0, 0, 0, 0,
-			       HAVE_JD | HAVE_DF | COMPLEX_DAT);
+			       HAVE_JD | HAVE_DF);
 	    }
 	}
 	break;
@@ -7169,7 +7169,7 @@ d_lite_marshal_load(VALUE self, VALUE a) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L7169
 
 		set_to_complex(self, &dat->c, nth, jd, df, sf, of, sg,
 			       0, 0, 0, 0, 0, 0,
-			       HAVE_JD | HAVE_DF | COMPLEX_DAT);
+			       HAVE_JD | HAVE_DF);
 	    }
 	}
 	break;

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

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