summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-06-27 23:14:10 +0900
committerNobuyoshi Nakada <[email protected]>2023-06-27 23:14:10 +0900
commit913e01e80ec5fd771ae096c992893d5e736e7fae ()
treed32c73f3a8cd5aa31b0bfbb0c8ce302f537c03dd /re.c
parentdf5ae0a55005f7f02adbf21790300f28dc2e12fc (diff)
Stop allocating unused backref strings at `defined?`
Notes: Merged: https://.com/ruby/ruby/pull/7983
-rw-r--r--re.c28
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