ruby-changes:45037
From: nobu <ko1@a...>
Date: Sun, 18 Dec 2016 20:43:56 +0900 (JST)
Subject: [ruby-changes:45037] nobu:r57110 (trunk): re.c: use name_to_backref_number
nobu 2016-12-18 20:43:51 +0900 (Sun, 18 Dec 2016) New Revision: 57110 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57110 Log: re.c: use name_to_backref_number * re.c (match_backref_number): use name_to_backref_number for casts. Modified files: trunk/re.c Index: re.c =================================================================== --- re.c (revision 57109) +++ re.c (revision 57110) @@ -1111,6 +1111,8 @@ match_size(VALUE match) https://github.com/ruby/ruby/blob/trunk/re.c#L1111 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 https://github.com/ruby/ruby/blob/trunk/re.c#L1136 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); @@ -1819,7 +1818,7 @@ static int https://github.com/ruby/ruby/blob/trunk/re.c#L1818 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), - (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)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/