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

ruby-changes:30362

From: nobu <ko1@a...>
Date: Thu, 8 Aug 2013 10:27:28 +0900 (JST)
Subject: [ruby-changes:30362] nobu:r42431 (trunk): range.c: revert r42400

nobu	2013-08-08 10:27:19 +0900 (Thu, 08 Aug 2013)

  New Revision: 42431

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

  Log:
    range.c: revert r42400
    
    * range.c (range_last): revert r42400.  [Bug #8739]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/http/header.rb
    trunk/range.c
_______________________________________________
ruby-cvs mailing list
ruby-cvs@r...
http://lists.ruby-lang.org/cgi-bin/mailman/listinfo/ruby-cvs
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42430)
+++ ChangeLog	(revision 42431)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Aug  8 10:27:18 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* range.c (range_last): revert r42400.  [Bug #8739]
+
 Thu Aug  8 10:26:25 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* file.c (rb_str_normalize_ospath): extract and move from dir.c.
Index: lib/net/http/header.rb
===================================================================
--- lib/net/http/header.rb	(revision 42430)
+++ lib/net/http/header.rb	(revision 42431)
@@ -237,7 +237,8 @@ module Net::HTTPHeader https://github.com/ruby/ruby/blob/trunk/lib/net/http/header.rb#L237
       rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
     when Range
       first = r.first
-      last = r.last
+      last = r.end
+      last -= 1 if r.exclude_end?
       if last == -1
         rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
       else
Index: range.c
===================================================================
--- range.c	(revision 42430)
+++ range.c	(revision 42431)
@@ -887,22 +887,7 @@ range_first(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/range.c#L887
 static VALUE
 range_last(int argc, VALUE *argv, VALUE range)
 {
-    if (argc == 0) {
-	VALUE e = RANGE_END(range);
-	if (!EXCL(range)) return e; /* inclusive, the end is the last */
-	/* exclusive, the last is previous to the end */
-	if (FIXNUM_P(e) || rb_obj_is_kind_of(e, rb_cNumeric)) {
-	    VALUE pred = rb_int_pred(e);
-	    if (!r_lt(RANGE_BEG(range), pred)) {
-		/* TODO: what should be returned, or should raise an
-		 * exception? */
-		pred = Qnil;
-	    }
-	    return pred;
-	}
-
-	/* fallback to Array */
-    }
+    if (argc == 0) return RANGE_END(range);
     return rb_ary_last(argc, argv, rb_Array(range));
 }
 

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

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