diff options
-rw-r--r-- | enumerator.c | 2 | ||||
-rw-r--r-- | error.c | 4 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | ext/io/console/console.c | 2 | ||||
-rw-r--r-- | ext/objspace/objspace.c | 6 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 4 | ||||
-rw-r--r-- | ext/pty/pty.c | 2 | ||||
-rw-r--r-- | ext/racc/cparse/cparse.c | 2 | ||||
-rw-r--r-- | ext/socket/ancdata.c | 4 | ||||
-rw-r--r-- | ext/socket/raddrinfo.c | 12 | ||||
-rw-r--r-- | ext/stringio/stringio.c | 6 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 2 | ||||
-rw-r--r-- | hash.c | 2 | ||||
-rw-r--r-- | io.c | 22 | ||||
-rw-r--r-- | marshal.c | 4 | ||||
-rw-r--r-- | pack.c | 4 | ||||
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | string.c | 4 | ||||
-rw-r--r-- | thread.c | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
21 files changed, 46 insertions, 46 deletions
diff --git a/enumerator.c b/enumerator.c index 3d26b0bc76..e62eabf61f 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1369,7 +1369,7 @@ static VALUE lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv) { VALUE result = rb_yield_values2(argc - 1, &argv[1]); - if (TYPE(result) == T_ARRAY) { + if (RB_TYPE_P(result, T_ARRAY)) { long i; for (i = 0; i < RARRAY_LEN(result); i++) { rb_funcall(argv[0], id_yield, 1, RARRAY_PTR(result)[i]); @@ -451,7 +451,7 @@ rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *pare int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type) { - if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA || + if (!RB_TYPE_P(obj, T_DATA) || !RTYPEDDATA_P(obj) || !rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) { return 0; } @@ -464,7 +464,7 @@ rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type) const char *etype; static const char mesg[] = "wrong argument type %s (expected %s)"; - if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA) { + if (!RB_TYPE_P(obj, T_DATA)) { etype = builtin_type_name(obj); rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name); } @@ -1058,7 +1058,7 @@ errinfo_place(rb_thread_t *th) return &cfp->dfp[-2]; } else if (cfp->iseq->type == ISEQ_TYPE_ENSURE && - TYPE(cfp->dfp[-2]) != T_NODE && + !RB_TYPE_P(cfp->dfp[-2], T_NODE) && !FIXNUM_P(cfp->dfp[-2])) { return &cfp->dfp[-2]; } diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 7880e7ae78..cedc057bb3 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -659,7 +659,7 @@ console_dev(VALUE klass) if (klass == rb_cIO) klass = rb_cFile; if (rb_const_defined(klass, id_console)) { con = rb_const_get(klass, id_console); - if (TYPE(con) == T_FILE) { + if (RB_TYPE_P(con, T_FILE)) { if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1) return con; } diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index f37499fc27..337dcb87e2 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -300,7 +300,7 @@ count_objects_size(int argc, VALUE *argv, VALUE os) VALUE hash; if (rb_scan_args(argc, argv, "01", &hash) == 1) { - if (TYPE(hash) != T_HASH) + if (!RB_TYPE_P(hash, T_HASH)) rb_raise(rb_eTypeError, "non-hash given"); } @@ -404,7 +404,7 @@ count_nodes(int argc, VALUE *argv, VALUE os) VALUE hash; if (rb_scan_args(argc, argv, "01", &hash) == 1) { - if (TYPE(hash) != T_HASH) + if (!RB_TYPE_P(hash, T_HASH)) rb_raise(rb_eTypeError, "non-hash given"); } @@ -609,7 +609,7 @@ count_tdata_objects(int argc, VALUE *argv, VALUE self) VALUE hash; if (rb_scan_args(argc, argv, "01", &hash) == 1) { - if (TYPE(hash) != T_HASH) + if (!RB_TYPE_P(hash, T_HASH)) rb_raise(rb_eTypeError, "non-hash given"); } diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 84a2b5d61b..f890019cf9 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -9,7 +9,7 @@ get_strpath(VALUE obj) { VALUE strpath; strpath = rb_ivar_get(obj, id_at_path); - if (TYPE(strpath) != T_STRING) + if (!RB_TYPE_P(strpath, T_STRING)) rb_raise(rb_eTypeError, "unexpected @path"); return strpath; } @@ -28,7 +28,7 @@ static VALUE path_initialize(VALUE self, VALUE arg) { VALUE str; - if (TYPE(arg) == T_STRING) { + if (RB_TYPE_P(arg, T_STRING)) { str = arg; } else { diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 126e33c8a6..06d4075726 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -461,7 +461,7 @@ pty_close_pty(VALUE assoc) for (i = 0; i < 2; i++) { io = rb_ary_entry(assoc, i); - if (TYPE(io) == T_FILE && 0 <= RFILE(io)->fptr->fd) + if (RB_TYPE_P(io, T_FILE) && 0 <= RFILE(io)->fptr->fd) rb_io_close(io); } return Qnil; diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c index 3a2a8ae74e..10a9a030ac 100644 --- a/ext/racc/cparse/cparse.c +++ b/ext/racc/cparse/cparse.c @@ -416,7 +416,7 @@ extract_user_token(struct cparse_params *v, VALUE block_args, return; } - if (TYPE(block_args) != T_ARRAY) { + if (!RB_TYPE_P(block_args, T_ARRAY)) { rb_raise(rb_eTypeError, "%s() %s %s (must be Array[2])", v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token", diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index f8379ccdd4..52f92a170a 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -196,7 +196,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass) for (i = 0 ; i < argc; i++) { VALUE obj = argv[i]; - if (TYPE(obj) != T_FILE) { + if (!RB_TYPE_P(obj, T_FILE)) { rb_raise(rb_eTypeError, "IO expected"); } rb_ary_push(ary, obj); @@ -1496,7 +1496,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) rb_secure(4); vopts = Qnil; - if (0 < argc && TYPE(argv[argc-1]) == T_HASH) + if (0 < argc && RB_TYPE_P(argv[argc-1], T_HASH)) vopts = argv[--argc]; rb_scan_args(argc, argv, "03", &vmaxdatlen, &vflags, &vmaxctllen); diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 8c409f181f..a7391c95b8 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -673,25 +673,25 @@ make_inspectname(VALUE node, VALUE service, struct addrinfo *res) sizeof(hbuf), pbuf, sizeof(pbuf), NI_NUMERICHOST|NI_NUMERICSERV); if (ret == 0) { - if (TYPE(node) == T_STRING && strcmp(hbuf, RSTRING_PTR(node)) == 0) + if (RB_TYPE_P(node, T_STRING) && strcmp(hbuf, RSTRING_PTR(node)) == 0) node = Qnil; - if (TYPE(service) == T_STRING && strcmp(pbuf, RSTRING_PTR(service)) == 0) + if (RB_TYPE_P(service, T_STRING) && strcmp(pbuf, RSTRING_PTR(service)) == 0) service = Qnil; - else if (TYPE(service) == T_FIXNUM && atoi(pbuf) == FIX2INT(service)) + else if (RB_TYPE_P(service, T_FIXNUM) && atoi(pbuf) == FIX2INT(service)) service = Qnil; } } - if (TYPE(node) == T_STRING) { + if (RB_TYPE_P(node, T_STRING)) { inspectname = rb_str_dup(node); } - if (TYPE(service) == T_STRING) { + if (RB_TYPE_P(service, T_STRING)) { if (NIL_P(inspectname)) inspectname = rb_sprintf(":%s", StringValueCStr(service)); else rb_str_catf(inspectname, ":%s", StringValueCStr(service)); } - else if (TYPE(service) == T_FIXNUM && FIX2INT(service) != 0) + else if (RB_TYPE_P(service, T_FIXNUM) && FIX2INT(service) != 0) { if (NIL_P(inspectname)) inspectname = rb_sprintf(":%d", FIX2INT(service)); diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 12e4a6c1c7..2ed0943512 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -506,7 +506,7 @@ static VALUE strio_reopen(int argc, VALUE *argv, VALUE self) { rb_io_taint_check(self); - if (argc == 1 && TYPE(*argv) != T_STRING) { + if (argc == 1 && !RB_TYPE_P(*argv, T_STRING)) { return strio_copy(self, *argv); } strio_init(argc, argv, StringIO(self)); @@ -931,7 +931,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr) break; case 1: - if (!NIL_P(str) && TYPE(str) != T_STRING) { + if (!NIL_P(str) && !RB_TYPE_P(str, T_STRING)) { VALUE tmp = rb_check_string_type(str); if (NIL_P(tmp)) { limit = NUM2LONG(str); @@ -1124,7 +1124,7 @@ strio_write(VALUE self, VALUE str) rb_encoding *enc, *enc2; RB_GC_GUARD(str); - if (TYPE(str) != T_STRING) + if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); enc = rb_enc_get(ptr->string); enc2 = rb_enc_get(str); diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index fee74bfc98..40864969f1 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -3369,7 +3369,7 @@ rb_gzwriter_write(VALUE obj, VALUE str) { struct gzfile *gz = get_gzfile(obj); - if (TYPE(str) != T_STRING) + if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); if (gz->enc2 && gz->enc2 != rb_ascii8bit_encoding()) { str = rb_str_conv_enc(str, rb_enc_get(str), gz->enc2); @@ -45,7 +45,7 @@ rb_any_cmp(VALUE a, VALUE b) return a != b; } if (RB_TYPE_P(a, T_STRING) && RBASIC(a)->klass == rb_cString && - TYPE(b) == T_STRING && RBASIC(b)->klass == rb_cString) { + RB_TYPE_P(b, T_STRING) && RBASIC(b)->klass == rb_cString) { return rb_str_hash_cmp(a, b); } if (a == Qundef || b == Qundef) return -1; @@ -6495,7 +6495,7 @@ rb_f_printf(int argc, VALUE *argv) VALUE out; if (argc == 0) return Qnil; - if (TYPE(argv[0]) == T_STRING) { + if (RB_TYPE_P(argv[0], T_STRING)) { out = rb_stdout; } else { @@ -6705,7 +6705,7 @@ rb_io_puts(int argc, VALUE *argv, VALUE out) return Qnil; } for (i=0; i<argc; i++) { - if (TYPE(argv[i]) == T_STRING) { + if (RB_TYPE_P(argv[i], T_STRING)) { line = argv[i]; goto string; } @@ -7336,7 +7336,7 @@ argf_forward(int argc, VALUE *argv, VALUE argf) #define next_argv() argf_next_argv(argf) #define ARGF_GENERIC_INPUT_P() \ - (ARGF.current_file == rb_stdin && TYPE(ARGF.current_file) != T_FILE) + (ARGF.current_file == rb_stdin && !RB_TYPE_P(ARGF.current_file, T_FILE)) #define ARGF_FORWARD(argc, argv) do {\ if (ARGF_GENERIC_INPUT_P())\ return argf_forward((argc), (argv), argf);\ @@ -9831,13 +9831,13 @@ copy_stream_body(VALUE arg) stp->total = 0; if (stp->src == argf || - !(TYPE(stp->src) == T_FILE || - TYPE(stp->src) == T_STRING || + !(RB_TYPE_P(stp->src, T_FILE) || + RB_TYPE_P(stp->src, T_STRING) || rb_respond_to(stp->src, rb_intern("to_path")))) { src_fd = -1; } else { - src_io = TYPE(stp->src) == T_FILE ? stp->src : Qnil; + src_io = RB_TYPE_P(stp->src, T_FILE) ? stp->src : Qnil; if (NIL_P(src_io)) { VALUE args[2]; int oflags = O_RDONLY; @@ -9858,13 +9858,13 @@ copy_stream_body(VALUE arg) stp->src_fd = src_fd; if (stp->dst == argf || - !(TYPE(stp->dst) == T_FILE || - TYPE(stp->dst) == T_STRING || + !(RB_TYPE_P(stp->dst, T_FILE) || + RB_TYPE_P(stp->dst, T_STRING) || rb_respond_to(stp->dst, rb_intern("to_path")))) { dst_fd = -1; } else { - dst_io = TYPE(stp->dst) == T_FILE ? stp->dst : Qnil; + dst_io = RB_TYPE_P(stp->dst, T_FILE) ? stp->dst : Qnil; if (NIL_P(dst_io)) { VALUE args[3]; int oflags = O_WRONLY|O_CREAT|O_TRUNC; @@ -10609,7 +10609,7 @@ argf_getbyte(VALUE argf) retry: if (!next_argv()) return Qnil; - if (TYPE(ARGF.current_file) != T_FILE) { + if (!RB_TYPE_P(ARGF.current_file, T_FILE)) { ch = rb_funcall3(ARGF.current_file, rb_intern("getbyte"), 0, 0); } else { @@ -10649,7 +10649,7 @@ argf_readchar(VALUE argf) retry: if (!next_argv()) rb_eof_error(); - if (TYPE(ARGF.current_file) != T_FILE) { + if (!RB_TYPE_P(ARGF.current_file, T_FILE)) { ch = rb_funcall3(ARGF.current_file, rb_intern("getc"), 0, 0); } else { @@ -1025,7 +1025,7 @@ r_byte(struct load_arg *arg) { int c; - if (TYPE(arg->src) == T_STRING) { + if (RB_TYPE_P(arg->src, T_STRING)) { if (RSTRING_LEN(arg->src) > arg->offset) { c = (unsigned char)RSTRING_PTR(arg->src)[arg->offset++]; } @@ -1099,7 +1099,7 @@ r_bytes0(long len, struct load_arg *arg) VALUE str; if (len == 0) return rb_str_new(0, 0); - if (TYPE(arg->src) == T_STRING) { + if (RB_TYPE_P(arg->src, T_STRING)) { if (RSTRING_LEN(arg->src) - arg->offset >= len) { str = rb_str_new(RSTRING_PTR(arg->src)+arg->offset, len); arg->offset += len; @@ -2057,7 +2057,7 @@ pack_unpack(VALUE str, VALUE fmt) p = RARRAY_PTR(a); pend = p + RARRAY_LEN(a); while (p < pend) { - if (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) { + if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) { if (len < RSTRING_LEN(*p)) { tmp = rb_tainted_str_new(t, len); rb_str_associate(tmp, a); @@ -2099,7 +2099,7 @@ pack_unpack(VALUE str, VALUE fmt) p = RARRAY_PTR(a); pend = p + RARRAY_LEN(a); while (p < pend) { - if (TYPE(*p) == T_STRING && RSTRING_PTR(*p) == t) { + if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) { tmp = *p; break; } @@ -1970,7 +1970,7 @@ proc_binding(VALUE self) rb_binding_t *bind; GetProcPtr(self, proc); - if (TYPE(proc->block.iseq) == T_NODE) { + if (RB_TYPE_P((VALUE)proc->block.iseq, T_NODE)) { if (!IS_METHOD_PROC_NODE((NODE *)proc->block.iseq)) { rb_raise(rb_eArgError, "Can't create Binding from C level Proc"); } @@ -2907,7 +2907,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) long len; rb_check_arity(argc, 1, 3); - if (TYPE(argv[0]) == T_REGEXP) { + if (RB_TYPE_P(argv[0], T_REGEXP)) { VALUE re = argv[0]; if (argc > 1) { @@ -3244,7 +3244,7 @@ static VALUE rb_str_aref_m(int argc, VALUE *argv, VALUE str) { if (argc == 2) { - if (TYPE(argv[0]) == T_REGEXP) { + if (RB_TYPE_P(argv[0], T_REGEXP)) { return rb_str_subpat(str, argv[0], argv[1]); } return rb_str_substr(str, NUM2LONG(argv[0]), NUM2LONG(argv[1])); @@ -3469,7 +3469,7 @@ static VALUE rb_str_aset_m(int argc, VALUE *argv, VALUE str) { if (argc == 3) { - if (TYPE(argv[0]) == T_REGEXP) { + if (RB_TYPE_P(argv[0], T_REGEXP)) { rb_str_subpat_set(str, argv[0], argv[1], argv[2]); } else { @@ -733,7 +733,7 @@ thread_join(rb_thread_t *target_th, double delay) if (FIXNUM_P(err)) { /* */ } - else if (TYPE(target_th->errinfo) == T_NODE) { + else if (RB_TYPE_P(target_th->errinfo, T_NODE)) { rb_exc_raise(rb_vm_make_jump_tag_but_local_jump( GET_THROWOBJ_STATE(err), GET_THROWOBJ_VAL(err))); } diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 1e9b852d2e..e67e0b9cd4 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -153,7 +153,7 @@ unknown_keyword_error(const rb_iseq_t *iseq, VALUE hash) rb_hash_delete(hash, ID2SYM(iseq->arg_keyword_table[i])); } keys = rb_funcall(hash, rb_intern("keys"), 0, 0); - if (TYPE(keys) != T_ARRAY) rb_raise(rb_eArgError, "unknown keyword"); + if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword"); msg = RARRAY_LEN(keys) == 1 ? "unknown keyword: %s" : "unknown keywords: %s"; keys = rb_funcall(keys, rb_intern("join"), 1, sep); RB_GC_GUARD(keys); |