From b2916f1b5cbebc2e7c10a757a36b6c6c4d36e583 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 18 Mar 2017 02:34:56 +0900 Subject: Avoid mrb_check_string_type() in raising exception; fix #3506 The change may reduce flexibility, but I believe no one wants that level of flexibility here. --- src/error.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/error.c') diff --git a/src/error.c b/src/error.c index 931361763..01c0e376c 100644 --- a/src/error.c +++ b/src/error.c @@ -435,8 +435,8 @@ mrb_bug(mrb_state *mrb, const char *fmt, ...) exit(EXIT_FAILURE); } -static mrb_value -make_exception(mrb_state *mrb, int argc, const mrb_value *argv, mrb_bool isstr) +MRB_API mrb_value +mrb_make_exception(mrb_state *mrb, int argc, const mrb_value *argv) { mrb_value mesg; int n; @@ -448,12 +448,9 @@ make_exception(mrb_state *mrb, int argc, const mrb_value *argv, mrb_bool isstr) case 1: if (mrb_nil_p(argv[0])) break; - if (isstr) { - mesg = mrb_check_string_type(mrb, argv[0]); - if (!mrb_nil_p(mesg)) { - mesg = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, mesg); - break; - } + if (mrb_string_p(argv[0])) { + mesg = mrb_exc_new_str(mrb, E_RUNTIME_ERROR, argv[0]); + break; } n = 0; goto exception_call; @@ -488,12 +485,6 @@ exception_call: return mesg; } -MRB_API mrb_value -mrb_make_exception(mrb_state *mrb, int argc, const mrb_value *argv) -{ - return make_exception(mrb, argc, argv, TRUE); -} - MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg) { -- cgit v1.2.3