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:
parent
86f229ec32
commit
9fc44b8790
9
re.c
9
re.c
@ -1111,6 +1111,8 @@ match_size(VALUE match)
|
|||||||
return INT2FIX(RMATCH_REGS(match)->num_regs);
|
return INT2FIX(RMATCH_REGS(match)->num_regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int name_to_backref_number(struct re_registers *, VALUE, const char*, const char*);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
match_backref_number(VALUE match, VALUE backref)
|
match_backref_number(VALUE match, VALUE backref)
|
||||||
{
|
{
|
||||||
@ -1134,10 +1136,7 @@ match_backref_number(VALUE match, VALUE backref)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = onig_name_to_backref_number(RREGEXP_PTR(regexp),
|
num = name_to_backref_number(regs, regexp, name, name + strlen(name));
|
||||||
(const unsigned char*)name,
|
|
||||||
(const unsigned char*)name + strlen(name),
|
|
||||||
regs);
|
|
||||||
|
|
||||||
if (num < 1) {
|
if (num < 1) {
|
||||||
rb_raise(rb_eIndexError, "undefined group name reference: %s", name);
|
rb_raise(rb_eIndexError, "undefined group name reference: %s", name);
|
||||||
@ -1819,7 +1818,7 @@ static int
|
|||||||
name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end)
|
name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end)
|
||||||
{
|
{
|
||||||
return onig_name_to_backref_number(RREGEXP_PTR(regexp),
|
return onig_name_to_backref_number(RREGEXP_PTR(regexp),
|
||||||
(const unsigned char* )name, (const unsigned char* )name_end, regs);
|
(const unsigned char *)name, (const unsigned char *)name_end, regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN(static void name_to_backref_error(VALUE name));
|
NORETURN(static void name_to_backref_error(VALUE name));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user