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

ruby-changes:3019

From: ko1@a...
Date: 23 Dec 2007 11:27:03 +0900
Subject: [ruby-changes:3019] nobu - Ruby:r14511 (trunk): * string.c (sym_call): use exact argument array interface.

nobu	2007-12-23 11:26:45 +0900 (Sun, 23 Dec 2007)

  New Revision: 14511

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_block.rb
    trunk/bootstraptest/test_knownbug.rb
    trunk/string.c

  Log:
    * string.c (sym_call): use exact argument array interface.
      [ruby-core:14279]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14511&r2=14510
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_block.rb?r1=14511&r2=14510
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14511&r2=14510
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_knownbug.rb?r1=14511&r2=14510

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14510)
+++ ChangeLog	(revision 14511)
@@ -1,3 +1,8 @@
+Sun Dec 23 11:26:43 2007  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (sym_call): use exact argument array interface.
+	  [ruby-core:14279]
+
 Sun Dec 23 11:01:35 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_io_binmode_m): removed C99ism.
Index: bootstraptest/test_knownbug.rb
===================================================================
--- bootstraptest/test_knownbug.rb	(revision 14510)
+++ bootstraptest/test_knownbug.rb	(revision 14511)
@@ -3,13 +3,6 @@
 # So all tests will cause failure.
 #
 
-assert_normal_exit %q{
-  def foo(&block)
-    yield if block
-  end
-  foo(&:bar)
-}, '[ruby-core:14279]'
-
 assert_equal 'ok', %q{
   open("tmp", "w") {|f| f.write "a\u00FFb" }
   s = open("tmp", "r:iso-8859-1:utf-8") {|f|
Index: bootstraptest/test_block.rb
===================================================================
--- bootstraptest/test_block.rb	(revision 14510)
+++ bootstraptest/test_block.rb	(revision 14511)
@@ -497,3 +497,13 @@
     result
   end
 }
+
+assert_equal "ok", %q{
+  class Bar
+    def bar; :ok; end
+  end
+  def foo
+    yield(Bar.new) if block_given?
+  end
+  foo(&:bar)
+}, '[ruby-core:14279]'
Index: string.c
===================================================================
--- string.c	(revision 14510)
+++ string.c	(revision 14511)
@@ -5519,17 +5519,15 @@
 }
 
 static VALUE
-sym_call(VALUE args, VALUE sym)
+sym_call(VALUE args, VALUE sym, int argc, VALUE *argv)
 {
     VALUE obj;
 
-    if (RARRAY_LEN(args) < 1) {
+    if (argc < 1) {
 	rb_raise(rb_eArgError, "no receiver given");
     }
-    obj = RARRAY_PTR(args)[0];
-    return rb_funcall3(obj, (ID)sym,
-		       RARRAY_LEN(args) - 1,
-		       RARRAY_PTR(args) + 1);
+    obj = argv[0];
+    return rb_funcall3(obj, (ID)sym, argc - 1, argv + 1);
 }
 
 /*

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

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