* array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,

range.c: use prepared IDs.
  A patch from charliesome (Charlie Somerville).
  [Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-12-02 09:57:47 +00:00
Родитель d64a73e1dd
Коммит f6f388a5bd
10 изменённых файлов: 38 добавлений и 24 удалений

Просмотреть файл

@ -1,3 +1,14 @@
Sun Dec 2 18:46:24 2012 Koichi Sasada <ko1@atdot.net>
* array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
range.c: use prepared IDs.
A patch from charliesome (Charlie Somerville).
[Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.
Sun Dec 2 16:48:00 2012 Zachary Scott <zachary@zacharyscott.net>
* lib/weakref.rb (rdoc): Clean up usage, add example,

Просмотреть файл

@ -17,6 +17,7 @@
#include "ruby/encoding.h"
#include "internal.h"
#include "probes.h"
#include "id.h"
#ifndef ARRAY_DEBUG
# define NDEBUG
@ -3045,7 +3046,7 @@ take_items(VALUE obj, long n)
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;
}

Просмотреть файл

@ -608,15 +608,14 @@ RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \
{$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \
{$(VPATH)}subst.h
ENCODING_H_INCLUDES= {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
ID_H_INCLUDES = {$(VPATH)}id.h
PROBES_H_INCLUDES = {$(VPATH)}probes.h
VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}thread_$(THREAD_MODEL).h \
{$(VPATH)}node.h {$(VPATH)}method.h {$(VPATH)}ruby_atomic.h \
{$(VPATH)}vm_debug.h $(ID_H_INCLUDES)
{$(VPATH)}vm_debug.h {$(VPATH)}id.h
addr2line.$(OBJEXT): {$(VPATH)}addr2line.c {$(VPATH)}addr2line.h {$(VPATH)}config.h
array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES)
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}id.h
bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
{$(VPATH)}thread.h {$(VPATH)}internal.h
class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) \
@ -638,7 +637,7 @@ encoding.$(OBJEXT): {$(VPATH)}encoding.c $(RUBY_H_INCLUDES) \
$(ENCODING_H_INCLUDES) {$(VPATH)}regenc.h {$(VPATH)}util.h \
{$(VPATH)}internal.h
enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
{$(VPATH)}util.h $(ID_H_INCLUDES)
{$(VPATH)}util.h {$(VPATH)}id.h
enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
{$(VPATH)}internal.h
error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}known_errors.inc \
@ -665,7 +664,7 @@ inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) \
{$(VPATH)}internal.h
io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
{$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}dln.h \
{$(VPATH)}internal.h {$(VPATH)}thread.h
{$(VPATH)}internal.h {$(VPATH)}thread.h {$(VPATH)}id.h
main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h {$(VPATH)}vm_debug.h
marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}internal.h
@ -674,13 +673,13 @@ math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES) \
node.$(OBJEXT): {$(VPATH)}node.c $(RUBY_H_INCLUDES) \
$(VM_CORE_H_INCLUDES)
numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) \
{$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
{$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
{$(VPATH)}internal.h {$(VPATH)}constant.h $(ENCODING_H_INCLUDES) $(PROBES_H_INCLUDES)
pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES) {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h
parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
$(ENCODING_H_INCLUDES) $(ID_H_INCLUDES) {$(VPATH)}regenc.h \
$(ENCODING_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}regenc.h \
{$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c \
{$(VPATH)}defs/keywords {$(VPATH)}id.c {$(VPATH)}parse.y \
{$(VPATH)}parse.h {$(VPATH)}vm_opts.h \
@ -695,7 +694,7 @@ process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) \
random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES) \
{$(VPATH)}siphash.c {$(VPATH)}siphash.h
range.$(OBJEXT): {$(VPATH)}range.c $(RUBY_H_INCLUDES) \
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h
$(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
re.$(OBJEXT): {$(VPATH)}re.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}util.h \
@ -771,7 +770,7 @@ vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \
debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) \
$(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_intern.h \
{$(VPATH)}util.h
id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) $(ID_H_INCLUDES) {$(VPATH)}vm_opts.h
id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}vm_opts.h
vm_backtrace.$(OBJEXT): {$(VPATH)}vm_backtrace.c \
$(VM_CORE_H_INCLUDES) $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
{$(VPATH)}internal.h {$(VPATH)}iseq.h {$(VPATH)}debug.h

4
enum.c
Просмотреть файл

@ -2498,7 +2498,7 @@ enum_chunk(int argc, VALUE *argv, VALUE enumerable)
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;
}
@ -2720,7 +2720,7 @@ enum_slice_before(int argc, VALUE *argv, VALUE enumerable)
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;
}

Просмотреть файл

@ -751,7 +751,7 @@ defined
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;
}

5
io.c
Просмотреть файл

@ -16,6 +16,7 @@
#include "ruby/thread.h"
#include "dln.h"
#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <errno.h>
@ -7579,7 +7580,7 @@ argf_getline(int argc, VALUE *argv, VALUE argf)
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) {
@ -7657,7 +7658,7 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
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);
}
/*

Просмотреть файл

@ -13,6 +13,7 @@
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <math.h>
#include <stdio.h>
@ -1528,7 +1529,7 @@ int_round_0(VALUE num, int ndigits)
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);
}

Просмотреть файл

@ -2837,13 +2837,13 @@ primary : literal
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)));

Просмотреть файл

@ -2851,7 +2851,7 @@ save_env(struct rb_execarg *sargp)
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;
}

Просмотреть файл

@ -12,6 +12,7 @@
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "id.h"
#ifdef HAVE_FLOAT_H
#include <float.h>
@ -88,7 +89,7 @@ range_initialize(int argc, VALUE *argv, VALUE range)
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;
@ -432,7 +433,7 @@ range_step(int argc, VALUE *argv, VALUE range)
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;
@ -924,7 +925,7 @@ range_first(int argc, VALUE *argv, VALUE range)
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];
}