ruby-changes:63262
From: Aaron <ko1@a...>
Date: Sat, 3 Oct 2020 04:02:21 +0900 (JST)
Subject: [ruby-changes:63262] 6aa466ba9c (master): mark regex internal to string scanner
https://git.ruby-lang.org/ruby.git/commit/?id=6aa466ba9c From 6aa466ba9cf3a0a597716bf7584735ca980622d0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Fri, 2 Oct 2020 10:54:31 -0700 Subject: mark regex internal to string scanner diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 61c8d89..db87818 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -176,6 +176,7 @@ strscan_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L176 { struct strscanner *p = ptr; rb_gc_mark(p->str); + rb_gc_mark(p->regex); } static void @@ -212,6 +213,7 @@ strscan_s_allocate(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L213 CLEAR_MATCH_STATUS(p); onig_region_init(&(p->regs)); p->str = Qnil; + p->regex = Qnil; return obj; } @@ -1168,7 +1170,7 @@ strscan_aref(VALUE self, VALUE idx) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1170 idx = rb_sym2str(idx); /* fall through */ case T_STRING: - if (!p->regex) return Qnil; + if (!RTEST(p->regex)) return Qnil; RSTRING_GETMEM(idx, name, i); i = name_to_backref_number(&(p->regs), p->regex, name, name + i, rb_enc_get(idx)); break; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/