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

ruby-changes:42165

From: nobu <ko1@a...>
Date: Thu, 24 Mar 2016 11:43:39 +0900 (JST)
Subject: [ruby-changes:42165] nobu:r54239 (trunk): strftime.c: fix false failure

nobu	2016-03-24 11:43:34 +0900 (Thu, 24 Mar 2016)

  New Revision: 54239

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

  Log:
    strftime.c: fix false failure
    
    * strftime.c (rb_strftime_with_timespec): remove unnecessary
      check, as `s` equals to `endp` when recursed STRFTIME resized
      the capacity same as the size.

  Modified files:
    trunk/ChangeLog
    trunk/strftime.c
    trunk/test/ruby/test_time.rb
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 54238)
+++ test/ruby/test_time.rb	(revision 54239)
@@ -651,6 +651,8 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L651
     assert_equal("UTC", t2000.strftime("%Z"))
     assert_equal("%", t2000.strftime("%%"))
     assert_equal("0", t2000.strftime("%-S"))
+    assert_equal("12:00:00 AM", t2000.strftime("%r"))
+    assert_equal("Sat 2000-01-01T00:00:00", t2000.strftime("%3a %FT%T"))
 
     assert_equal("", t2000.strftime(""))
     assert_equal("foo\0bar\x0000\x0000\x0000", t2000.strftime("foo\0bar\0%H\0%M\0%S"))
Index: strftime.c
===================================================================
--- strftime.c	(revision 54238)
+++ strftime.c	(revision 54239)
@@ -851,7 +851,7 @@ rb_strftime_with_timespec(VALUE ftime, c https://github.com/ruby/ruby/blob/trunk/strftime.c#L851
 			}
 		}
 	}
-	if (s >= endp || format != format_end) {
+	if (format != format_end) {
 		return 0;
 	}
 	len = s - start;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54238)
+++ ChangeLog	(revision 54239)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Mar 24 11:43:32 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* strftime.c (rb_strftime_with_timespec): remove unnecessary
+	  check, as `s` equals to `endp` when recursed STRFTIME resized
+	  the capacity same as the size.
+
 Wed Mar 23 21:48:00 2016  Kenta Murata  <mrkn@m...>
 
 	* enum.c (ary_inject_op): put subtract operation out of if-clause.

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

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