diff options
| author | Yukihiro Matz Matsumoto <[email protected]> | 2013-03-27 23:41:23 +0900 |
|---|---|---|
| committer | Yukihiro Matz Matsumoto <[email protected]> | 2013-03-27 23:41:23 +0900 |
| commit | 18b2683b97ae54d4f2f15c19076f33aa29eaf2b7 (patch) | |
| tree | f6afd41abfd7b0ad8b76bb5e618e6ee0fbdc6723 /src/etc.c | |
| parent | 8ce842a5d978132c5733cacb7c15bb3d0f5ce66d (diff) | |
| download | mruby-18b2683b97ae54d4f2f15c19076f33aa29eaf2b7.tar.gz mruby-18b2683b97ae54d4f2f15c19076f33aa29eaf2b7.zip | |
use new mrb_format API from mrb_raisef; its only format specifier is "%S" (stringify) and takes mrb_value; close #1062
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 */ |
