diff options
| author | Satoshi Tagomori <tagomoris@gmail.com> | 2024-07-31 10:15:29 +0900 |
|---|---|---|
| committer | Koichi Sasada <ko1@atdot.net> | 2024-07-31 10:59:51 +0900 |
| commit | 19ec803179eb698e5aa72e1a024d60a4e4ff1a87 (patch) | |
| tree | 72bc2be86cb9f25b2c8c7a8d4b244e28a898a8c1 /ext | |
| parent | 7aea269b89bd7024bcacb7fe7d4ddb0be2f215af (diff) | |
Reset the counter for two consecutive runs
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11284
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/-test-/ensure_and_callcc/ensure_and_callcc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/ensure_and_callcc/ensure_and_callcc.c b/ext/-test-/ensure_and_callcc/ensure_and_callcc.c index aef83769a6..1a92de69c3 100644 --- a/ext/-test-/ensure_and_callcc/ensure_and_callcc.c +++ b/ext/-test-/ensure_and_callcc/ensure_and_callcc.c @@ -40,11 +40,19 @@ ensure_called(VALUE self) return rb_iv_get(rb_mEnsureAndCallcc, "@ensure_called"); } +static VALUE +reset(VALUE self) +{ + rb_iv_set(rb_mEnsureAndCallcc, "@ensure_called", INT2FIX(0)); + return Qnil; +} + void Init_ensure_and_callcc(void) { rb_mEnsureAndCallcc = rb_define_module("EnsureAndCallcc"); rb_iv_set(rb_mEnsureAndCallcc, "@ensure_called", INT2FIX(0)); + rb_define_singleton_method(rb_mEnsureAndCallcc, "reset", reset, 0); rb_define_singleton_method(rb_mEnsureAndCallcc, "ensure_called", ensure_called, 0); rb_define_singleton_method(rb_mEnsureAndCallcc, "require_with_ensure", require_with_ensure, 1); } |
