diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-09-29 16:44:04 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 18:20:30 +0900 |
| commit | 82046ff26ec9ae93d6d0cb5132a1dfd9651b5c3f (patch) | |
| tree | f4e36e2d7642887b9c968efff6710651a14f48b7 /src | |
| parent | 3d6adccfbec44fb13a75ef7055f10fb87242d1fc (diff) | |
| download | mruby-82046ff26ec9ae93d6d0cb5132a1dfd9651b5c3f.tar.gz mruby-82046ff26ec9ae93d6d0cb5132a1dfd9651b5c3f.zip | |
Revert "Add a new function `mrb_exc_protect()`."
This reverts commit 8746a6fe4e7bda8a0fbc0eaece9314ec51a0c255.
We already have `mrb_protect()`, `mrb_ensure()` and `mrb_rescue()`
functions. If you need to handle exceptions from C functions, use those
functions above.
Diffstat (limited to 'src')
| -rw-r--r-- | src/error.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/error.c b/src/error.c index c077c8663..b19f0ea43 100644 --- a/src/error.c +++ b/src/error.c @@ -555,29 +555,6 @@ mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max) #undef FMT } -MRB_API mrb_value -mrb_exc_protect(mrb_state *mrb, mrb_value (*body)(mrb_state*, void*), void *a, - mrb_value (*resc)(mrb_state*, void*, mrb_value), void *b) -{ - struct mrb_jmpbuf *prev_jmp = mrb->jmp; - struct mrb_jmpbuf c_jmp; - mrb_value v = mrb_undef_value(); - - MRB_TRY(&c_jmp) { - mrb->jmp = &c_jmp; - v = body(mrb, a); - } MRB_CATCH(&c_jmp) { - if (mrb->exc) { - v = resc(mrb, b, mrb_obj_value(mrb->exc)); - mrb->exc = NULL; - } - } MRB_END_EXC(&c_jmp); - - mrb->jmp = prev_jmp; - - return v; -} - void mrb_core_init_printabort(void); int |
