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

ruby-changes:22288

From: tadf <ko1@a...>
Date: Thu, 19 Jan 2012 07:54:20 +0900 (JST)
Subject: [ruby-changes:22288] tadf:r34337 (trunk): ext/date/date_strptime.c: moved detector of leftover.

tadf	2012-01-19 07:54:09 +0900 (Thu, 19 Jan 2012)

  New Revision: 34337

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

  Log:
    ext/date/date_strptime.c: moved detector of leftover.

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_strptime.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34336)
+++ ChangeLog	(revision 34337)
@@ -1,3 +1,7 @@
+Thu Jan 19 07:53:09 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_strptime.c: moved detector of leftover.
+
 Thu Jan 19 07:10:47 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_parse.c: [ruby-core:42173].
Index: ext/date/date_strptime.c
===================================================================
--- ext/date/date_strptime.c	(revision 34336)
+++ ext/date/date_strptime.c	(revision 34337)
@@ -1,5 +1,5 @@
 /*
-  date_strptime.c: Coded by Tadayoshi Funaba 2011
+  date_strptime.c: Coded by Tadayoshi Funaba 2011,2012
 */
 
 #include "ruby.h"
@@ -641,15 +641,6 @@
 	}
     }
 
-    {
-	VALUE s;
-
-	if (slen > si) {
-	    s = rb_usascii_str_new(&str[si], slen - si);
-	    set_hash("leftover", s);
-	}
-    }
-
     return si;
 }
 
@@ -657,10 +648,18 @@
 date__strptime(const char *str, size_t slen,
 	       const char *fmt, size_t flen, VALUE hash)
 {
+    size_t si;
     VALUE cent, merid;
 
-    date__strptime_internal(str, slen, fmt, flen, hash);
+    si = date__strptime_internal(str, slen, fmt, flen, hash);
 
+    if (slen > si) {
+	VALUE s;
+
+	s = rb_usascii_str_new(&str[si], slen - si);
+	set_hash("leftover", s);
+    }
+
     if (fail_p())
 	return Qnil;
 

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

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