diff options
author | S.H <gamelinks007@gmail.com> | 2021-10-30 19:24:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-30 19:24:41 +0900 |
commit | a46c220320778c29612b80ebf2fee28a81eaa380 (patch) | |
tree | 09516cb0d0282d03203c5e4bcb3939a3f2762cd1 /error.c | |
parent | 99dad28b7c14fce45653a3573172389cb0424341 (diff) |
Add `rb_mod_exc_raise` function and replace duplicate code
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5063
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -3188,36 +3188,41 @@ rb_syserr_new_path_in(const char *func_name, int n, VALUE path) } #endif +NORETURN(static void rb_mod_exc_raise(VALUE exc, VALUE mod)); + +static void +rb_mod_exc_raise(VALUE exc, VALUE mod) +{ + rb_extend_object(exc, mod); + rb_exc_raise(exc); +} + void rb_mod_sys_fail(VALUE mod, const char *mesg) { VALUE exc = make_errno_exc(mesg); - rb_extend_object(exc, mod); - rb_exc_raise(exc); + rb_mod_exc_raise(exc, mod); } void rb_mod_sys_fail_str(VALUE mod, VALUE mesg) { VALUE exc = make_errno_exc_str(mesg); - rb_extend_object(exc, mod); - rb_exc_raise(exc); + rb_mod_exc_raise(exc, mod); } void rb_mod_syserr_fail(VALUE mod, int e, const char *mesg) { VALUE exc = rb_syserr_new(e, mesg); - rb_extend_object(exc, mod); - rb_exc_raise(exc); + rb_mod_exc_raise(exc, mod); } void rb_mod_syserr_fail_str(VALUE mod, int e, VALUE mesg) { VALUE exc = rb_syserr_new_str(e, mesg); - rb_extend_object(exc, mod); - rb_exc_raise(exc); + rb_mod_exc_raise(exc, mod); } static void |