[ruby/strscan] Use C90 as far as supporting 2.6 or earlier
(https://github.com/ruby/strscan/pull/101) https://github.com/ruby/strscan/commit/d31274f41b
This commit is contained in:
parent
e7f06402dd
commit
d6046bccb7
@ -626,12 +626,13 @@ rb_reg_onig_match(VALUE re, VALUE str,
|
||||
OnigPosition (*match)(regex_t *reg, VALUE str, struct re_registers *regs, void *args),
|
||||
void *args, struct re_registers *regs)
|
||||
{
|
||||
OnigPosition result;
|
||||
regex_t *reg = rb_reg_prepare_re(re, str);
|
||||
|
||||
bool tmpreg = reg != RREGEXP_PTR(re);
|
||||
if (!tmpreg) RREGEXP(re)->usecnt++;
|
||||
|
||||
OnigPosition result = match(reg, str, regs, args);
|
||||
result = match(reg, str, regs, args);
|
||||
|
||||
if (!tmpreg) RREGEXP(re)->usecnt--;
|
||||
if (tmpreg) {
|
||||
@ -694,12 +695,13 @@ strscan_do_scan(VALUE self, VALUE pattern, int succptr, int getstr, int headonly
|
||||
}
|
||||
|
||||
if (RB_TYPE_P(pattern, T_REGEXP)) {
|
||||
OnigPosition ret;
|
||||
p->regex = pattern;
|
||||
OnigPosition ret = rb_reg_onig_match(pattern,
|
||||
p->str,
|
||||
headonly ? strscan_match : strscan_search,
|
||||
(void *)p,
|
||||
&(p->regs));
|
||||
ret = rb_reg_onig_match(p->regex,
|
||||
p->str,
|
||||
headonly ? strscan_match : strscan_search,
|
||||
(void *)p,
|
||||
&(p->regs));
|
||||
|
||||
if (ret == ONIG_MISMATCH) {
|
||||
return Qnil;
|
||||
@ -1139,13 +1141,14 @@ static VALUE
|
||||
strscan_scan_byte(VALUE self)
|
||||
{
|
||||
struct strscanner *p;
|
||||
VALUE byte;
|
||||
|
||||
GET_SCANNER(self, p);
|
||||
CLEAR_MATCH_STATUS(p);
|
||||
if (EOS_P(p))
|
||||
return Qnil;
|
||||
|
||||
VALUE byte = INT2FIX((unsigned char)*CURPTR(p));
|
||||
byte = INT2FIX((unsigned char)*CURPTR(p));
|
||||
p->prev = p->curr;
|
||||
p->curr++;
|
||||
MATCHED(p);
|
||||
@ -2114,8 +2117,8 @@ static VALUE
|
||||
strscan_named_captures(VALUE self)
|
||||
{
|
||||
struct strscanner *p;
|
||||
GET_SCANNER(self, p);
|
||||
named_captures_data data;
|
||||
GET_SCANNER(self, p);
|
||||
data.self = self;
|
||||
data.captures = rb_hash_new();
|
||||
if (!RB_NIL_P(p->regex)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user