diff options
author | Nobuyoshi Nakada <[email protected]> | 2023-06-27 23:14:10 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2023-06-27 23:14:10 +0900 |
commit | 913e01e80ec5fd771ae096c992893d5e736e7fae () | |
tree | d32c73f3a8cd5aa31b0bfbb0c8ce302f537c03dd /re.c | |
parent | df5ae0a55005f7f02adbf21790300f28dc2e12fc (diff) |
Stop allocating unused backref strings at `defined?`
Notes: Merged: https://.com/ruby/ruby/pull/7983
-rw-r--r-- | re.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -1935,21 +1935,37 @@ rb_reg_match_post(VALUE match) return str; } -VALUE -rb_reg_match_last(VALUE match) { int i; struct re_registers *regs; - if (NIL_P(match)) return Qnil; match_check(match); regs = RMATCH_REGS(match); - if (BEG(0) == -1) return Qnil; for (i=regs->num_regs-1; BEG(i) == -1 && i > 0; i--) ; - if (i == 0) return Qnil; - return rb_reg_nth_match(i, match); } static VALUE |