diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-18 02:34:56 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-18 02:34:56 +0900 |
| commit | b2916f1b5cbebc2e7c10a757a36b6c6c4d36e583 (patch) | |
| tree | 67f547285e77b862baaf11989e631807d07d50b6 /src/error.c | |
| parent | 27fc76f6c63e21a83e5df306c46e694433eedd30 (diff) | |
| download | mruby-b2916f1b5cbebc2e7c10a757a36b6c6c4d36e583.tar.gz mruby-b2916f1b5cbebc2e7c10a757a36b6c6c4d36e583.zip | |
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.
Diffstat (limited to 'src/error.c')
| -rw-r--r-- | src/error.c | 19 |
1 files changed, 5 insertions, 14 deletions
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) { |
