diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-13 15:34:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-13 15:34:34 +0000 |
commit | 24476c0c0baaea216d3a4756c4ebea4dfd265b1a (patch) | |
tree | 3c97d42b864d5457e4b0bad8016afedf4b8309e9 /error.c | |
parent | 723bfaba5944a205844ef37456d5dbf2e92291ee (diff) | |
download | ruby-24476c0c0baaea216d3a4756c4ebea4dfd265b1a.tar.gz |
* eval_error.c (error_print): use RB_TYPE_P instead of TYPE.
* error.c (rb_check_backtrace): ditto.
* error.c (name_err_mesg_to_str): compare immediate values
directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -685,14 +685,12 @@ rb_check_backtrace(VALUE bt) static const char err[] = "backtrace must be Array of String"; if (!NIL_P(bt)) { - int t = TYPE(bt); - - if (t == T_STRING) return rb_ary_new3(1, bt); - if (t != T_ARRAY) { + if (RB_TYPE_P(bt, T_STRING)) return rb_ary_new3(1, bt); + if (!RB_TYPE_P(bt, T_ARRAY)) { rb_raise(rb_eTypeError, err); } for (i=0;i<RARRAY_LEN(bt);i++) { - if (TYPE(RARRAY_PTR(bt)[i]) != T_STRING) { + if (!RB_TYPE_P(RARRAY_PTR(bt)[i], T_STRING)) { rb_raise(rb_eTypeError, err); } } @@ -1045,14 +1043,14 @@ name_err_mesg_to_str(VALUE obj) int state = 0; obj = ptr[1]; - switch (TYPE(obj)) { - case T_NIL: + switch (obj) { + case Qnil: desc = "nil"; break; - case T_TRUE: + case Qtrue: desc = "true"; break; - case T_FALSE: + case Qfalse: desc = "false"; break; default: |