summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 84286cf..10061b4 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 cf3961c..e7eb9cf 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) {