re.c: use name_to_backref_number

* re.c (match_backref_number): use name_to_backref_number for
  casts.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-12-18 11:43:51 +00:00
parent 86f229ec32
commit 9fc44b8790

7
re.c
View File

@ -1111,6 +1111,8 @@ match_size(VALUE match)
return INT2FIX(RMATCH_REGS(match)->num_regs);
}
static int name_to_backref_number(struct re_registers *, VALUE, const char*, const char*);
static int
match_backref_number(VALUE match, VALUE backref)
{
@ -1134,10 +1136,7 @@ match_backref_number(VALUE match, VALUE backref)
break;
}
num = onig_name_to_backref_number(RREGEXP_PTR(regexp),
(const unsigned char*)name,
(const unsigned char*)name + strlen(name),
regs);
num = name_to_backref_number(regs, regexp, name, name + strlen(name));
if (num < 1) {
rb_raise(rb_eIndexError, "undefined group name reference: %s", name);