diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-15 04:37:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-15 04:37:26 +0000 |
commit | 3660a7b38b17fa9c1d97971cd62eb883caeb210d (patch) | |
tree | a49f1ca0bb1b070c525b5ba80a8dc644f10ecc62 /string.c | |
parent | 44c193383dc148bad840b12065666ef41908102c (diff) | |
download | ruby-3660a7b38b17fa9c1d97971cd62eb883caeb210d.tar.gz |
proc.c: proc without env
* proc.c (rb_sym_to_proc): move from string.c and create a Proc
with no environments. [ruby-core:71088] [Bug #11594]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 29 |
1 files changed, 2 insertions, 27 deletions
@@ -8960,6 +8960,7 @@ rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passe return rb_funcall_with_block(obj, (ID)sym, argc - 1, argv + 1, passed_proc); } +#if 0 /* * call-seq: * sym.to_proc @@ -8972,34 +8973,8 @@ rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passe VALUE rb_sym_to_proc(VALUE sym) { - static VALUE sym_proc_cache = Qfalse; - enum {SYM_PROC_CACHE_SIZE = 67}; - VALUE proc; - long index; - ID id; - VALUE *aryp; - - if (!sym_proc_cache) { - sym_proc_cache = rb_ary_tmp_new(SYM_PROC_CACHE_SIZE * 2); - rb_gc_register_mark_object(sym_proc_cache); - rb_ary_store(sym_proc_cache, SYM_PROC_CACHE_SIZE*2 - 1, Qnil); - } - - id = SYM2ID(sym); - index = (id % SYM_PROC_CACHE_SIZE) << 1; - - aryp = RARRAY_PTR(sym_proc_cache); - if (aryp[index] == sym) { - return aryp[index + 1]; - } - else { - proc = rb_proc_new(rb_sym_proc_call, (VALUE)id); - rb_block_clear_env_self(proc); - aryp[index] = sym; - aryp[index + 1] = proc; - return proc; - } } +#endif /* * call-seq: |