* string.c (sym_to_proc): tabified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a9a4435e12
commit
53e7e2d2a1
16
string.c
16
string.c
@ -6922,9 +6922,9 @@ sym_to_proc(VALUE sym)
|
|||||||
VALUE *aryp;
|
VALUE *aryp;
|
||||||
|
|
||||||
if (!sym_proc_cache) {
|
if (!sym_proc_cache) {
|
||||||
sym_proc_cache = rb_ary_tmp_new(SYM_PROC_CACHE_SIZE * 2);
|
sym_proc_cache = rb_ary_tmp_new(SYM_PROC_CACHE_SIZE * 2);
|
||||||
rb_gc_register_mark_object(sym_proc_cache);
|
rb_gc_register_mark_object(sym_proc_cache);
|
||||||
rb_ary_store(sym_proc_cache, SYM_PROC_CACHE_SIZE*2 - 1, Qnil);
|
rb_ary_store(sym_proc_cache, SYM_PROC_CACHE_SIZE*2 - 1, Qnil);
|
||||||
}
|
}
|
||||||
|
|
||||||
id = SYM2ID(sym);
|
id = SYM2ID(sym);
|
||||||
@ -6932,13 +6932,13 @@ sym_to_proc(VALUE sym)
|
|||||||
|
|
||||||
aryp = RARRAY_PTR(sym_proc_cache);
|
aryp = RARRAY_PTR(sym_proc_cache);
|
||||||
if (aryp[index] == sym) {
|
if (aryp[index] == sym) {
|
||||||
return aryp[index + 1];
|
return aryp[index + 1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
proc = rb_proc_new(sym_call, (VALUE)id);
|
proc = rb_proc_new(sym_call, (VALUE)id);
|
||||||
aryp[index] = sym;
|
aryp[index] = sym;
|
||||||
aryp[index + 1] = proc;
|
aryp[index + 1] = proc;
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user