ruby-changes:21308
From: nobu <ko1@a...>
Date: Thu, 29 Sep 2011 20:08:10 +0900 (JST)
Subject: [ruby-changes:21308] nobu:r33357 (trunk): * use RB_TYPE_P which is optimized for constant types, instead of
nobu 2011-09-29 20:07:45 +0900 (Thu, 29 Sep 2011) New Revision: 33357 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33357 Log: * use RB_TYPE_P which is optimized for constant types, instead of comparison with TYPE. Modified files: trunk/ChangeLog trunk/array.c trunk/bignum.c trunk/class.c trunk/compile.c trunk/complex.c trunk/enum.c trunk/enumerator.c trunk/error.c trunk/eval.c trunk/eval_error.c trunk/gc.c trunk/hash.c trunk/io.c trunk/marshal.c trunk/math.c trunk/numeric.c trunk/object.c trunk/pack.c trunk/parse.y trunk/proc.c trunk/process.c trunk/random.c trunk/range.c trunk/rational.c trunk/re.c trunk/ruby.c trunk/safe.c trunk/string.c trunk/struct.c trunk/thread.c trunk/time.c trunk/transcode.c trunk/variable.c trunk/vm_eval.c trunk/vm_insnhelper.c trunk/vm_method.c Index: complex.c =================================================================== --- complex.c (revision 33356) +++ complex.c (revision 33357) @@ -121,7 +121,7 @@ if (FIXNUM_P(y)) { long iy = FIX2LONG(y); if (iy == 0) { - if (FIXNUM_P(x) || TYPE(x) == T_BIGNUM) + if (FIXNUM_P(x) || RB_TYPE_P(x, T_BIGNUM)) return ZERO; } else if (iy == 1) @@ -130,7 +130,7 @@ else if (FIXNUM_P(x)) { long ix = FIX2LONG(x); if (ix == 0) { - if (FIXNUM_P(y) || TYPE(y) == T_BIGNUM) + if (FIXNUM_P(y) || RB_TYPE_P(y, T_BIGNUM)) return ZERO; } else if (ix == 1) @@ -166,14 +166,14 @@ inline static VALUE f_to_i(VALUE x) { - if (TYPE(x) == T_STRING) + if (RB_TYPE_P(x, T_STRING)) return rb_str_to_inum(x, 10, 0); return rb_funcall(x, id_to_i, 0); } inline static VALUE f_to_f(VALUE x) { - if (TYPE(x) == T_STRING) + if (RB_TYPE_P(x, T_STRING)) return DBL2NUM(rb_str_to_dbl(x, 0)); return rb_funcall(x, id_to_f, 0); } @@ -944,7 +944,7 @@ { if (k_numeric_p(other) && f_real_p(other)) return rb_assoc_new(f_complex_new_bang1(CLASS_OF(self), other), self); - if (TYPE(other) == T_COMPLEX) + if (RB_TYPE_P(other, T_COMPLEX)) return rb_assoc_new(other, self); rb_raise(rb_eTypeError, "%s can't be coerced into %s", Index: array.c =================================================================== --- array.c (revision 33356) +++ array.c (revision 33357) @@ -2016,7 +2016,7 @@ sort_optimizable_count }; -#define STRING_P(s) (TYPE(s) == T_STRING && CLASS_OF(s) == rb_cString) +#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString) #define SORT_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(sort_opt_,type)) #define SORT_OPTIMIZABLE(data, type) \ @@ -3137,7 +3137,7 @@ for (i = 0; i < RARRAY_LEN(ary); ++i) { v = RARRAY_PTR(ary)[i]; - if (TYPE(v) == T_ARRAY && + if (RB_TYPE_P(v, T_ARRAY) && RARRAY_LEN(v) > 1 && rb_equal(RARRAY_PTR(v)[1], value)) return v; @@ -3176,7 +3176,7 @@ rb_ary_equal(VALUE ary1, VALUE ary2) { if (ary1 == ary2) return Qtrue; - if (TYPE(ary2) != T_ARRAY) { + if (!RB_TYPE_P(ary2, T_ARRAY)) { if (!rb_respond_to(ary2, rb_intern("to_ary"))) { return Qfalse; } @@ -3211,7 +3211,7 @@ rb_ary_eql(VALUE ary1, VALUE ary2) { if (ary1 == ary2) return Qtrue; - if (TYPE(ary2) != T_ARRAY) return Qfalse; + if (!RB_TYPE_P(ary2, T_ARRAY)) return Qfalse; if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse; return rb_exec_recursive_paired(recursive_eql, ary1, ary2, ary2); } Index: math.c =================================================================== --- math.c (revision 33356) +++ math.c (revision 33357) @@ -24,7 +24,7 @@ VALUE rb_mMath; VALUE rb_eMathDomainError; -#define Need_Float(x) do {if (TYPE(x) != T_FLOAT) {(x) = rb_to_float(x);}} while(0) +#define Need_Float(x) do {if (!RB_TYPE_P(x, T_FLOAT)) {(x) = rb_to_float(x);}} while(0) #define Need_Float2(x,y) do {\ Need_Float(x);\ Need_Float(y);\ Index: time.c =================================================================== --- time.c (revision 33356) +++ time.c (revision 33357) @@ -73,7 +73,7 @@ if (FIXABLE(l)) return LONG2FIX(l); return LONG2NUM(l); } - if (TYPE(x) == T_BIGNUM) return rb_big_plus(x, y); + if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_plus(x, y); return rb_funcall(x, '+', 1, y); } @@ -85,7 +85,7 @@ if (FIXABLE(l)) return LONG2FIX(l); return LONG2NUM(l); } - if (TYPE(x) == T_BIGNUM) return rb_big_minus(x, y); + if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_minus(x, y); return rb_funcall(x, '-', 1, y); } @@ -148,7 +148,7 @@ return LONG2NUM(z); #endif } - if (TYPE(x) == T_BIGNUM) + if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_mul(x, y); return rb_funcall(x, '*', 1, y); } @@ -182,7 +182,7 @@ } } ret = rb_funcall(x, id_quo, 1, y); - if (TYPE(ret) == T_RATIONAL && + if (RB_TYPE_P(ret, T_RATIONAL) && RRATIONAL(ret)->den == INT2FIX(1)) { ret = RRATIONAL(ret)->num; } @@ -391,7 +391,7 @@ if (FIXNUM_P(v)) { return WIDEVAL_WRAP((WIDEVALUE)(SIGNED_WIDEVALUE)(long)v); } - else if (TYPE(v) == T_BIGNUM && + else if (RB_TYPE_P(v, T_BIGNUM) && RBIGNUM_LEN(v) * sizeof(BDIGIT) <= sizeof(WIDEVALUE)) { return v2w_bignum(v); } @@ -451,7 +451,7 @@ else #endif x = w2v(wx); - if (TYPE(x) == T_BIGNUM) return v2w(rb_big_plus(x, w2v(wy))); + if (RB_TYPE_P(x, T_BIGNUM)) return v2w(rb_big_plus(x, w2v(wy))); return v2w(rb_funcall(x, '+', 1, w2v(wy))); } @@ -467,7 +467,7 @@ else #endif x = w2v(wx); - if (TYPE(x) == T_BIGNUM) return v2w(rb_big_minus(x, w2v(wy))); + if (RB_TYPE_P(x, T_BIGNUM)) return v2w(rb_big_minus(x, w2v(wy))); return v2w(rb_funcall(x, '-', 1, w2v(wy))); } @@ -525,9 +525,9 @@ } #endif x = w2v(wx); - if (TYPE(x) == T_BIGNUM) return v2w(rb_big_mul(x, w2v(wy))); + if (RB_TYPE_P(x, T_BIGNUM)) return v2w(rb_big_mul(x, w2v(wy))); z = rb_funcall(x, '*', 1, w2v(wy)); - if (TYPE(z) == T_RATIONAL && RRATIONAL(z)->den == INT2FIX(1)) { + if (RB_TYPE_P(z, T_RATIONAL) && RRATIONAL(z)->den == INT2FIX(1)) { z = RRATIONAL(z)->num; } return v2w(z); @@ -552,7 +552,7 @@ x = w2v(wx); y = w2v(wy); ret = rb_funcall(x, id_quo, 1, y); - if (TYPE(ret) == T_RATIONAL && + if (RB_TYPE_P(ret, T_RATIONAL) && RRATIONAL(ret)->den == INT2FIX(1)) { ret = RRATIONAL(ret)->num; } @@ -2536,7 +2536,7 @@ static int obj2int(VALUE obj) { - if (TYPE(obj) == T_STRING) { + if (RB_TYPE_P(obj, T_STRING)) { obj = rb_str_to_inum(obj, 10, FALSE); } @@ -2546,7 +2546,7 @@ static VALUE obj2vint(VALUE obj) { - if (TYPE(obj) == T_STRING) { + if (RB_TYPE_P(obj, T_STRING)) { obj = rb_str_to_inum(obj, 10, FALSE); } else { @@ -2561,7 +2561,7 @@ { VALUE subsec; - if (TYPE(obj) == T_STRING) { + if (RB_TYPE_P(obj, T_STRING)) { obj = rb_str_to_inum(obj, 10, FALSE); *subsecx = INT2FIX(0); return NUM2INT(obj); @@ -2575,7 +2575,7 @@ static long usec2subsecx(VALUE obj) { - if (TYPE(obj) == T_STRING) { + if (RB_TYPE_P(obj, T_STRING)) { obj = rb_str_to_inum(obj, 10, FALSE); } @@ -3216,7 +3216,7 @@ GetTimeval(time, tobj); v = w2v(rb_time_unmagnify(tobj->timew)); - if (TYPE(v) != T_RATIONAL) { + if (!RB_TYPE_P(v, T_RATIONAL)) { v = rb_Rational1(v); } return v; @@ -4642,7 +4642,7 @@ str = rb_str_new(buf, 8); rb_copy_generic_ivar(str, time); if (!rb_equal(nano, INT2FIX(0))) { - if (TYPE(nano) == T_RATIONAL) { + if (RB_TYPE_P(nano, T_RATIONAL)) { rb_ivar_set(str, id_nano_num, RRATIONAL(nano)->num); rb_ivar_set(str, id_nano_den, RRATIONAL(nano)->den); } Index: ChangeLog =================================================================== --- ChangeLog (revision 33356) +++ ChangeLog (revision 33357) @@ -1,3 +1,8 @@ +Thu Sep 29 20:07:36 2011 Nobuyoshi Nakada <nobu@r...> + + * use RB_TYPE_P which is optimized for constant types, instead of + comparison with TYPE. + Wed Sep 28 09:20:37 2011 Nobuyoshi Nakada <nobu@r...> * configure.in (pthread_np.h): needs pthread.h to be included Index: re.c =================================================================== --- re.c (revision 33356) +++ re.c (revision 33357) @@ -2587,7 +2587,7 @@ rb_reg_equal(VALUE re1, VALUE re2) { if (re1 == re2) return Qtrue; - if (TYPE(re2) != T_REGEXP) return Qfalse; + if (!RB_TYPE_P(re2, T_REGEXP)) return Qfalse; rb_reg_check(re1); rb_reg_check(re2); if (FL_TEST(re1, KCODE_FIXED) != FL_TEST(re2, KCODE_FIXED)) return Qfalse; if (RREGEXP(re1)->ptr->options != RREGEXP(re2)->ptr->options) return Qfalse; @@ -2635,7 +2635,7 @@ { const struct re_registers *regs1, *regs2; if (match1 == match2) return Qtrue; - if (TYPE(match2) != T_MATCH) return Qfalse; + if (!RB_TYPE_P(match2, T_MATCH)) return Qfalse; if (!rb_str_equal(RMATCH(match1)->str, RMATCH(match2)->str)) return Qfalse; if (!rb_reg_equal(RMATCH(match1)->regexp, RMATCH(match2)->regexp)) return Qfalse; regs1 = RMATCH_REGS(match1); @@ -2795,7 +2795,7 @@ long start; VALUE line = rb_lastline_get(); - if (TYPE(line) != T_STRING) { + if (!RB_TYPE_P(line, T_STRING)) { rb_backref_set(Qnil); return Qnil; } Index: enumerator.c =================================================================== --- enumerator.c (revision 33356) +++ enumerator.c (revision 33357) @@ -590,7 +590,7 @@ static VALUE ary2sv(VALUE args, int dup) { - if (TYPE(args) != T_ARRAY) + if (!RB_TYPE_P(args, T_ARRAY)) return args; switch (RARRAY_LEN(args)) { Index: variable.c =================================================================== --- variable.c (revision 33356) +++ variable.c (revision 33357) @@ -161,7 +161,7 @@ else { path = (VALUE)n; } - if (TYPE(path) != T_STRING) { + if (!RB_TYPE_P(path, T_STRING)) { rb_bug("class path is not set properly"); } return path; @@ -199,7 +199,7 @@ else { const char *s = "Class"; - if (TYPE(klass) == T_MODULE) { + if (RB_TYPE_P(klass, T_MODULE)) { if (rb_obj_class(klass) == rb_cModule) { s = "Module"; } @@ -2157,7 +2157,7 @@ static VALUE original_module(VALUE c) { - if (TYPE(c) == T_ICLASS) + if (RB_TYPE_P(c, T_ICLASS)) return RBASIC(c)->klass; return c; } Index: eval_error.c =================================================================== --- eval_error.c (revision 33356) +++ eval_error.c (revision 33357) @@ -202,7 +202,7 @@ } rb_name_error(id, "undefined%s method `%s' for %s `%s'", v, rb_id2name(id), - (TYPE(klass) == T_MODULE) ? "module" : "class", + (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class", rb_class2name(klass)); } @@ -211,7 +211,7 @@ { rb_name_error_str(name, "undefined method `%s' for %s `%s'", RSTRING_PTR(name), - (TYPE(klass) == T_MODULE) ? "module" : "class", + (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class", rb_class2name(klass)); } Index: enum.c =================================================================== --- enum.c (revision 33356) +++ enum.c (revision 33357) @@ -901,7 +901,7 @@ RETURN_ENUMERATOR(obj, 0, 0); - if (TYPE(obj) == T_ARRAY && RARRAY_LEN(obj) <= LONG_MAX/2) { + if (RB_TYPE_P(obj, T_ARRAY) && RARRAY_LEN(obj) <= LONG_MAX/2) { ary = rb_ary_new2(RARRAY_LEN(obj)*2); } else { Index: string.c =================================================================== --- string.c (revision 33356) +++ string.c (revision 33357) @@ -854,11 +854,11 @@ { VALUE str; - if (TYPE(obj) == T_STRING) { + if (RB_TYPE_P(obj, T_STRING)) { return obj; } str = rb_funcall(obj, id_to_s, 0); - if (TYPE(str) != T_STRING) + if (!RB_TYPE_P(str, T_STRING)) return rb_any_to_s(obj); if (OBJ_TAINTED(obj)) OBJ_TAINT(str); return str; @@ -1404,7 +1404,7 @@ rb_string_value(volatile VALUE *ptr) { VALUE s = *ptr; - if (TYPE(s) != T_STRING) { + if (!RB_TYPE_P(s, T_STRING)) { s = rb_str_to_str(s); *ptr = s; } @@ -2075,7 +2075,7 @@ { unsigned int lc; - if (FIXNUM_P(str2) || TYPE(str2) == T_BIGNUM) { + if (FIXNUM_P(str2) || RB_TYPE_P(str2, T_BIGNUM)) { if (rb_num_to_uint(str2, &lc) == 0) { } else if (FIXNUM_P(str2)) { @@ -2250,7 +2250,7 @@ rb_str_equal(VALUE str1, VALUE str2) { if (str1 == str2) return Qtrue; - if (TYPE(str2) != T_STRING) { + if (!RB_TYPE_P(str2, T_STRING)) { if (!rb_respond_to(str2, rb_intern("to_str"))) { return Qfalse; } @@ -2270,7 +2270,7 @@ rb_str_eql(VALUE str1, VALUE str2) { if (str1 == str2) return Qtrue; - if (TYPE(str2) != T_STRING) return Qfalse; + if (!RB_TYPE_P(str2, T_STRING)) return Qfalse; return str_eql(str1, str2); } @@ -2302,7 +2302,7 @@ { long result; - if (TYPE(str2) != T_STRING) { + if (!RB_TYPE_P(str2, T_STRING)) { if (!rb_respond_to(str2, rb_intern("to_str"))) { return Qnil; } @@ -2472,7 +2472,7 @@ if (pos < 0) { pos += str_strlen(str, STR_ENC_GET(str)); if (pos < 0) { - if (TYPE(sub) == T_REGEXP) { + if (RB_TYPE_P(sub, T_REGEXP)) { rb_backref_set(Qnil); } return Qnil; @@ -2581,7 +2581,7 @@ if (pos < 0) { pos += len; if (pos < 0) { - if (TYPE(sub) == T_REGEXP) { + if (RB_TYPE_P(sub, T_REGEXP)) { rb_backref_set(Qnil); } return Qnil; @@ -5751,7 +5751,7 @@ } else { fs_set: - if (TYPE(spat) == T_STRING) { + if (RB_TYPE_P(spat, T_STRING)) { rb_encoding *enc2 = STR_ENC_GET(spat); split_type = string; @@ -7064,7 +7064,7 @@ long pos; int regex = FALSE; - if (TYPE(sep) == T_REGEXP) { + if (RB_TYPE_P(sep, T_REGEXP)) { pos = rb_reg_search(sep, str, 0, 0); regex = TRUE; } @@ -7114,7 +7114,7 @@ long pos = RSTRING_LEN(str); int regex = FALSE; - if (TYPE(sep) == T_REGEXP) { + if (RB_TYPE_P(sep, T_REGEXP)) { pos = rb_reg_search(sep, str, pos, 1); regex = TRUE; } @@ -7206,7 +7206,7 @@ void rb_str_setter(VALUE val, ID id, VALUE *var) { - if (!NIL_P(val) && TYPE(val) != T_STRING) { + if (!NIL_P(val) && !RB_TYPE_P(val, T_STRING)) { rb_raise(rb_eTypeError, "value of %s must be String", rb_id2name(id)); } *var = val; Index: object.c =================================================================== --- object.c (revision 33356) +++ object.c (revision 33357) @@ -432,7 +432,7 @@ static VALUE rb_obj_inspect(VALUE obj) { - if (TYPE(obj) == T_OBJECT && rb_obj_basic_to_s_p(obj)) { + if (RB_TYPE_P(obj, T_OBJECT) && rb_obj_basic_to_s_p(obj)) { int has_ivar = 0; VALUE *ptr = ROBJECT_IVPTR(obj); long len = ROBJECT_NUMIV(obj); @@ -1661,7 +1661,7 @@ if (klass == rb_cBasicObject) return Qnil; rb_raise(rb_eTypeError, "uninitialized class"); } - while (TYPE(super) == T_ICLASS) { + while (RB_TYPE_P(super, T_ICLASS)) { super = RCLASS_SUPER(super); } if (!super) { @@ -2157,7 +2157,7 @@ VALUE v; if (FIXNUM_P(val)) return val; - if (TYPE(val) == T_BIGNUM) return val; + if (RB_TYPE_P(val, T_BIGNUM)) return val; v = convert_type(val, "Integer", method, TRUE); if (!rb_obj_is_kind_of(v, rb_cInteger)) { const char *cname = rb_obj_classname(val); @@ -2173,7 +2173,7 @@ VALUE v; if (FIXNUM_P(val)) return val; - if (TYPE(val) == T_BIGNUM) return val; + if (RB_TYPE_P(val, T_BIGNUM)) return val; v = convert_type(val, "Integer", method, FALSE); if (!rb_obj_is_kind_of(v, rb_cInteger)) { return Qnil; @@ -2437,7 +2437,7 @@ VALUE rb_to_float(VALUE val) { - if (TYPE(val) == T_FLOAT) return val; + if (RB_TYPE_P(val, T_FLOAT)) return val; if (!rb_obj_is_kind_of(val, rb_cNumeric)) { rb_raise(rb_eTypeError, "can't convert %s into Float", NIL_P(val) ? "nil" : @@ -2451,7 +2451,7 @@ VALUE rb_check_to_float(VALUE val) { - if (TYPE(val) == T_FLOAT) return val; + if (RB_TYPE_P(val, T_FLOAT)) return val; if (!rb_obj_is_kind_of(val, rb_cNumeric)) { return Qnil; } Index: io.c =================================================================== --- io.c (revision 33356) +++ io.c (revision 33357) @@ -1053,7 +1053,7 @@ { rb_io_t *fptr; - if (TYPE(io) != T_FILE) { + if (!RB_TYPE_P(io, T_FILE)) { return rb_funcall(io, id_flush, 0); } @@ -2117,7 +2117,7 @@ long n; rb_secure(4); - if (TYPE(str) != T_STRING) + if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); io = GetWriteIO(io); @@ -3144,7 +3144,7 @@ GetOpenFile(io, fptr); rb_io_check_byte_readable(fptr); READ_CHECK(fptr); - if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) && TYPE(rb_stdout) == T_FILE) { + if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) && RB_TYPE_P(rb_stdout, T_FILE)) { rb_io_t *ofp; GetOpenFile(rb_stdout, ofp); if (ofp->mode & FMODE_TTY) { @@ -3243,7 +3243,7 @@ if (FIXNUM_P(c)) { c = rb_enc_uint_chr(FIX2UINT(c), io_read_encoding(fptr)); } - else if (TYPE(c) == T_BIGNUM) { + else if (RB_TYPE_P(c, T_BIGNUM)) { c = rb_enc_uint_chr(NUM2UINT(c), io_read_encoding(fptr)); } else { @@ -3886,7 +3886,7 @@ long n; rb_secure(4); - if (TYPE(str) != T_STRING) + if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); io = GetWriteIO(io); @@ -6113,7 +6113,7 @@ rb_io_putc(VALUE io, VALUE ch) { VALUE str; - if (TYPE(ch) == T_STRING) { + if (RB_TYPE_P(ch, T_STRING)) { str = rb_str_substr(ch, 0, 1); } else { @@ -6254,7 +6254,7 @@ rb_p(VALUE obj) /* for debug print within C code */ { VALUE str = rb_obj_as_string(rb_inspect(obj)); - if (TYPE(rb_stdout) == T_FILE && + if (RB_TYPE_P(rb_stdout, T_FILE) && rb_method_basic_definition_p(CLASS_OF(rb_stdout), id_write)) { io_write(rb_stdout, str, 1); io_write(rb_stdout, rb_default_rs, 0); @@ -6298,7 +6298,7 @@ else if (argc > 1) { ret = rb_ary_new4(argc, argv); } - if (TYPE(rb_stdout) == T_FILE) { + if (RB_TYPE_P(rb_stdout, T_FILE)) { rb_io_flush(rb_stdout); } return ret; @@ -6845,7 +6845,7 @@ int stdout_binmode = 0; int fmode; - if (TYPE(rb_stdout) == T_FILE) { + if (RB_TYPE_P(rb_stdout, T_FILE)) { GetOpenFile(rb_stdout, fptr); if (fptr->mode & FMODE_BINMODE) stdout_binmode = 1; @@ -6885,7 +6885,7 @@ VALUE str; int fw; - if (TYPE(rb_stdout) == T_FILE && rb_stdout != orig_stdout) { + if (RB_TYPE_P(rb_stdout, T_FILE) && rb_stdout != orig_stdout) { rb_io_close(rb_stdout); } fstat(fr, &st); @@ -7770,7 +7770,7 @@ GetOpenFile(io, fptr); retval = io_cntl(fptr->fd, cmd, narg, io_p); if (retval < 0) rb_sys_fail_path(fptr->pathv); - if (TYPE(arg) == T_STRING && RSTRING_PTR(arg)[len] != 17) { + if (RB_TYPE_P(arg, T_STRING) && RSTRING_PTR(arg)[len] != 17) { rb_raise(rb_eArgError, "return value overflowed string"); } @@ -9269,7 +9269,7 @@ rb_io_t *fptr; VALUE v1, v2, opt; - if (TYPE(io) != T_FILE) { + if (!RB_TYPE_P(io, T_FILE)) { return rb_funcall2(io, id_set_encoding, argc, argv); } Index: pack.c =================================================================== --- pack.c (revision 33356) +++ pack.c (revision 33357) @@ -243,7 +243,7 @@ x = rb_to_int(x); /* is nil OK? (should not) */ if (FIXNUM_P(x)) return FIX2LONG(x); - if (TYPE(x) == T_BIGNUM) { + if (RB_TYPE_P(x, T_BIGNUM)) { return rb_big2ulong_pack(x); } rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x)); @@ -995,9 +995,9 @@ char c, *bufs, *bufe; from = NEXTFROM; - if (TYPE(from) == T_BIGNUM) { + if (RB_TYPE_P(from, T_BIGNUM)) { VALUE big128 = rb_uint2big(128); - while (TYPE(from) == T_BIGNUM) { + while (RB_TYPE_P(from, T_BIGNUM)) { from = rb_big_divmod(from, big128); c = NUM2INT(RARRAY_PTR(from)[1]) | 0x80; /* mod */ rb_str_buf_cat(buf, &c, sizeof(char)); Index: compile.c =================================================================== --- compile.c (revision 33356) +++ compile.c (revision 33357) @@ -1263,7 +1263,7 @@ cdhash_hash(VALUE a) { if (SPECIAL_CONST_P(a)) return (st_index_t)a; - if (TYPE(a) == T_STRING) return rb_str_hash(a); + if (RB_TYPE_P(a, T_STRING)) return rb_str_hash(a); { VALUE hval = rb_hash(a); return (st_index_t)FIX2LONG(hval); @@ -2335,7 +2335,7 @@ case NODE_LIT: { VALUE v = node->nd_lit; double ival; - if (TYPE(v) == T_FLOAT && + if (RB_TYPE_P(v, T_FLOAT) && modf(RFLOAT_VALUE(v), &ival) == 0.0) (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/