summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 09:25:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-10 09:25:58 +0000
commit16e7869ded99732192e867b4e900b457bdef88a9 (patch)
tree0c7e5194b5a2a9482ac7d523eac609baf0249802
parentbda0e2fd84340e34dee0804e250f531893da763a (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--hash.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 656c4b5..8264c24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov 10 18:25:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* proc.c (cfunc_proc_t): add room for me.
diff --git a/hash.c b/hash.c
index 5b1abbd..f34e6e7 100644
--- a/hash.c
+++ b/hash.c
@@ -2769,13 +2769,14 @@ rb_hash_gt(VALUE hash, VALUE other)
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;