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

ruby-changes:11635

From: akr <ko1@a...>
Date: Sat, 25 Apr 2009 15:41:14 +0900 (JST)
Subject: [ruby-changes:11635] Ruby:r23272 (trunk): * time.c (time_succ): refactored to avoid gmt variable.

akr	2009-04-25 15:40:59 +0900 (Sat, 25 Apr 2009)

  New Revision: 23272

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23272

  Log:
    * time.c (time_succ): refactored to avoid gmt variable.
      (strftimev): use TIME_UTC_P.
      (time_strftime): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/time.c

Index: time.c
===================================================================
--- time.c	(revision 23271)
+++ time.c	(revision 23272)
@@ -2445,13 +2445,12 @@
 time_succ(VALUE time)
 {
     struct time_object *tobj;
-    int gmt;
+    struct time_object *tobj2;
 
     GetTimeval(time, tobj);
-    gmt = tobj->gmt;
     time = time_new_timev(rb_cTime, add(tobj->timev, INT2FIX(1)));
-    GetTimeval(time, tobj);
-    tobj->gmt = gmt;
+    GetTimeval(time, tobj2);
+    tobj2->gmt = tobj->gmt;
     return time;
 }
 
@@ -2930,7 +2929,7 @@
 
     GetTimeval(time, tobj);
     MAKE_TM(time, tobj);
-    len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timev, tobj->gmt);
+    len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
     str = rb_str_new(buf, len);
     if (buf != buffer) xfree(buf);
     return str;
@@ -3013,7 +3012,7 @@
 
 	str = rb_str_new(0, 0);
 	while (p < pe) {
-	    len = rb_strftime_alloc(&buf, p, &tobj->vtm, tobj->timev, tobj->gmt);
+	    len = rb_strftime_alloc(&buf, p, &tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
 	    rb_str_cat(str, buf, len);
 	    p += strlen(p);
 	    if (buf != buffer) {
@@ -3027,7 +3026,7 @@
     }
     else {
 	len = rb_strftime_alloc(&buf, RSTRING_PTR(format),
-			       	&tobj->vtm, tobj->timev, tobj->gmt);
+			       	&tobj->vtm, tobj->timev, TIME_UTC_P(tobj));
     }
     str = rb_str_new(buf, len);
     if (buf != buffer) xfree(buf);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23271)
+++ ChangeLog	(revision 23272)
@@ -1,3 +1,9 @@
+Sat Apr 25 15:39:44 2009  Tanaka Akira  <akr@f...>
+
+	* time.c (time_succ): refactored to avoid gmt variable.
+	  (strftimev): use TIME_UTC_P.
+	  (time_strftime): ditto.
+
 Sat Apr 25 15:21:33 2009  Tanaka Akira  <akr@f...>
 
 	* time.c (TIME_UTC_P): new macro..

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

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