Project

General

Profile

Bug #7495 ยป clean_up_rb_interns.patch

Anonymous, 12/02/2012 03:00 PM

View differences:

array.c
#include "ruby/encoding.h"
#include "internal.h"
#include "probes.h"
#include "id.h"
#ifndef ARRAY_DEBUG
# define NDEBUG
......
if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
if (rb_check_block_call(obj, rb_intern("each"), 0, 0, take_i, (VALUE)args) == Qundef)
if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef)
Check_Type(obj, T_ARRAY);
return result;
}
enum.c
rb_ivar_set(enumerator, rb_intern("chunk_enumerable"), enumerable);
rb_ivar_set(enumerator, rb_intern("chunk_categorize"), rb_block_proc());
rb_ivar_set(enumerator, rb_intern("chunk_initial_state"), initial_state);
rb_block_call(enumerator, rb_intern("initialize"), 0, 0, chunk_i, enumerator);
rb_block_call(enumerator, idInitialize, 0, 0, chunk_i, enumerator);
return enumerator;
}
......
rb_ivar_set(enumerator, rb_intern("slicebefore_sep_pat"), sep_pat);
}
rb_ivar_set(enumerator, rb_intern("slicebefore_enumerable"), enumerable);
rb_block_call(enumerator, rb_intern("initialize"), 0, 0, slicebefore_i, enumerator);
rb_block_call(enumerator, idInitialize, 0, 0, slicebefore_i, enumerator);
return enumerator;
}
insns.def
VALUE r;
args[0] = obj; args[1] = Qfalse;
r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args);
r = rb_check_funcall(v, idRespond_to_missing, 2, args);
if (r != Qundef && RTEST(r))
expr_type = DEFINED_METHOD;
}
io.c
#include "ruby/thread.h"
#include "dln.h"
#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <errno.h>
......
retry:
if (!next_argv()) return Qnil;
if (ARGF_GENERIC_INPUT_P()) {
line = rb_funcall3(ARGF.current_file, rb_intern("gets"), argc, argv);
line = rb_funcall3(ARGF.current_file, idGets, argc, argv);
}
else {
if (argc == 0 && rb_rs == rb_default_rs) {
......
if (recv == argf) {
return argf_gets(argc, argv, argf);
}
return rb_funcall2(argf, rb_intern("gets"), argc, argv);
return rb_funcall2(argf, idGets, argc, argv);
}
/*
numeric.c
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>
......
ID op;
/* If 10**N / 2 > num, then return 0 */
/* We have log_256(10) > 0.415241 and log_256(1/2) = -0.125, so */
bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, rb_intern("size"), 0);
bytes = FIXNUM_P(num) ? sizeof(long) : rb_funcall(num, idSize, 0);
if (-0.415241 * ndigits - 0.125 > bytes ) {
return INT2FIX(0);
}
parse.y
m->nd_next = block_append(
NEW_IF(
NEW_NODE(NODE_AND,
NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("length"), 0),
rb_intern("=="), one),
NEW_CALL(NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero),
NEW_CALL(NEW_CALL(NEW_DVAR(id), idLength, 0),
idEq, one),
NEW_CALL(NEW_CALL(NEW_DVAR(id), idAREF, zero),
rb_intern("kind_of?"), NEW_LIST(NEW_LIT(rb_cArray))),
0),
NEW_DASGN_CURR(id,
NEW_CALL(NEW_DVAR(id), rb_intern("[]"), zero)),
NEW_CALL(NEW_DVAR(id), idAREF, zero)),
0),
node_assign($2, NEW_DVAR(id)));
process.c
VALUE env = rb_const_get(rb_cObject, rb_intern("ENV"));
if (RTEST(env)) {
VALUE ary = hide_obj(rb_ary_new());
rb_block_call(env, rb_intern("each"), 0, 0, save_env_i,
rb_block_call(env, idEach, 0, 0, save_env_i,
(VALUE)ary);
sargp->env_modification = ary;
}
range.c
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "id.h"
#ifdef HAVE_FLOAT_H
#include <float.h>
......
rb_scan_args(argc, argv, "21", &beg, &end, &flags);
/* Ranges are immutable, so that they should be initialized only once. */
if (RANGE_EXCL(range) != Qnil) {
rb_name_error(rb_intern("initialize"), "`initialize' called twice");
rb_name_error(idInitialize, "`initialize' called twice");
}
range_init(range, beg, end, RTEST(flags));
return Qnil;
......
else if (rb_obj_is_kind_of(b, rb_cNumeric) ||
!NIL_P(rb_check_to_integer(b, "to_int")) ||
!NIL_P(rb_check_to_integer(e, "to_int"))) {
ID op = EXCL(range) ? '<' : rb_intern("<=");
ID op = EXCL(range) ? '<' : idLE;
VALUE v = b;
int i = 0;
......
rb_scan_args(argc, argv, "1", &n);
ary[0] = n;
ary[1] = rb_ary_new2(NUM2LONG(n));
rb_block_call(range, rb_intern("each"), 0, 0, first_i, (VALUE)ary);
rb_block_call(range, idEach, 0, 0, first_i, (VALUE)ary);
return ary[1];
}
    (1-1/1)