summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-13 15:34:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-13 15:34:34 +0000
commit24476c0c0baaea216d3a4756c4ebea4dfd265b1a (patch)
tree3c97d42b864d5457e4b0bad8016afedf4b8309e9
parent723bfaba5944a205844ef37456d5dbf2e92291ee (diff)
* 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
-rw-r--r--error.c16
-rw-r--r--eval_error.c2
2 files changed, 8 insertions, 10 deletions
diff --git a/error.c b/error.c
index 84286cfcec..10061b46a8 100644
--- a/error.c
+++ b/error.c
@@ -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:
diff --git a/eval_error.c b/eval_error.c
index cf3961cb33..e7eb9cf0fc 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -168,7 +168,7 @@ error_print(void)
#define TRACE_TAIL 5
for (i = 1; i < len; i++) {
- if (TYPE(ptr[i]) == T_STRING) {
+ if (RB_TYPE_P(ptr[i], T_STRING)) {
warn_printf("\tfrom %s\n", RSTRING_PTR(ptr[i]));
}
if (skip && i == TRACE_HEAD && len > TRACE_MAX) {