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

ruby-changes:20574

From: naruse <ko1@a...>
Date: Fri, 22 Jul 2011 21:29:54 +0900 (JST)
Subject: [ruby-changes:20574] naruse:r32622 (trunk): * lib/uri/generic.rb (WFKV_): unroll the loop of regexp.

naruse	2011-07-22 21:29:13 +0900 (Fri, 22 Jul 2011)

  New Revision: 32622

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

  Log:
    * lib/uri/generic.rb (WFKV_): unroll the loop of regexp.
    
    * lib/uri/generic.rb (URI.decode_www_form_component): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/common.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32621)
+++ ChangeLog	(revision 32622)
@@ -1,3 +1,9 @@
+Fri Jul 22 21:18:20 2011  NARUSE, Yui  <naruse@r...>
+
+	* lib/uri/generic.rb (WFKV_): unroll the loop of regexp.
+
+	* lib/uri/generic.rb (URI.decode_www_form_component): ditto.
+
 Fri Jul 22 21:06:39 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
Index: lib/uri/common.rb
===================================================================
--- lib/uri/common.rb	(revision 32621)
+++ lib/uri/common.rb	(revision 32622)
@@ -908,7 +908,7 @@
       rescue
       end
     end
-    raise ArgumentError, "invalid %-encoding (#{str})" unless /\A(?:%\h\h|[^%]+)*\z/ =~ str
+    raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str
     str.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
   end
 
@@ -960,7 +960,7 @@
     end.join('&')
   end
 
-  WFKV_ = '(?:%\h\h|[^%#=;&])' # :nodoc:
+  WFKV_ = '(?:[^%#=;&]*(?:%\h\h[^%#=;&]*)*)' # :nodoc:
 
   # Decode URL-encoded form data from given +str+.
   #

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

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