diff options
Diffstat (limited to 'src/etc.c')
| -rw-r--r-- | src/etc.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -37,14 +37,13 @@ mrb_get_datatype(mrb_state *mrb, mrb_value obj, const mrb_data_type *type) void * mrb_check_datatype(mrb_state *mrb, mrb_value obj, const mrb_data_type *type) { - static const char mesg[] = "wrong argument type %s (expected %s)"; - if (mrb_special_const_p(obj) || (mrb_type(obj) != MRB_TT_DATA)) { mrb_check_type(mrb, obj, MRB_TT_DATA); } if (DATA_TYPE(obj) != type) { const char *etype = DATA_TYPE(obj)->struct_name; - mrb_raisef(mrb, E_TYPE_ERROR, mesg, etype, type->struct_name); + mrb_raisef(mrb, E_TYPE_ERROR, "wrong argument type %S (expected %S)", + mrb_str_new_cstr(mrb, etype), mrb_str_new_cstr(mrb, type->struct_name)); } return DATA_PTR(obj); } @@ -93,8 +92,7 @@ mrb_to_id(mrb_state *mrb, mrb_value name) tmp = mrb_check_string_type(mrb, name); if (mrb_nil_p(tmp)) { tmp = mrb_inspect(mrb, name); - mrb_raisef(mrb, E_TYPE_ERROR, "%s is not a symbol", - RSTRING_PTR(tmp)); + mrb_raisef(mrb, E_TYPE_ERROR, "%S is not a symbol", tmp); } name = tmp; /* fall through */ |
