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

ruby-changes:40443

From: nobu <ko1@a...>
Date: Tue, 10 Nov 2015 18:26:10 +0900 (JST)
Subject: [ruby-changes:40443] nobu:r52524 (trunk): hash.c: use rb_func_proc_new

nobu	2015-11-10 18:25:58 +0900 (Tue, 10 Nov 2015)

  New Revision: 52524

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

  Log:
    hash.c: use rb_func_proc_new
    
    * hash.c (rb_hash_to_proc): use rb_func_proc_new to make light
      weight proc.  [Feature #11653]

  Modified files:
    trunk/ChangeLog
    trunk/hash.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52523)
+++ ChangeLog	(revision 52524)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 10 18:25:56 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* hash.c (rb_hash_to_proc): use rb_func_proc_new to make light
+	  weight proc.  [Feature #11653]
+
 Tue Nov 10 18:23:35 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* proc.c (cfunc_proc_t): add room for me.
Index: hash.c
===================================================================
--- hash.c	(revision 52523)
+++ hash.c	(revision 52524)
@@ -2769,13 +2769,14 @@ rb_hash_gt(VALUE hash, VALUE other) https://github.com/ruby/ruby/blob/trunk/hash.c#L2769
 static VALUE
 hash_proc_call(VALUE key, VALUE hash, int argc, const VALUE *argv, VALUE passed_proc)
 {
-    return rb_hash_aref(hash, key);
+    rb_check_arity(argc, 1, 1);
+    return rb_hash_aref(hash, *argv);
 }
 
 static VALUE
 rb_hash_to_proc(VALUE hash)
 {
-    return rb_proc_new(hash_proc_call, hash);
+    return rb_func_proc_new(hash_proc_call, hash);
 }
 
 static int path_tainted = -1;

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

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