зеркало из https://github.com/github/ruby.git
* complex.c (string_to_c_internal): uses rb_reg_nth_match;
* rational.c (string_to_r_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5aee85cef1
Коммит
14c504b3cc
|
@ -1,3 +1,8 @@
|
|||
Fri Jun 10 00:35:12 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* complex.c (string_to_c_internal): uses rb_reg_nth_match;
|
||||
* rational.c (string_to_r_internal): ditto.
|
||||
|
||||
Fri Jun 10 00:25:03 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||
|
||||
* gc.c: remove an unused declaration.
|
||||
|
|
30
complex.c
30
complex.c
|
@ -1445,12 +1445,6 @@ make_patterns(void)
|
|||
#define id_match rb_intern("match")
|
||||
#define f_match(x,y) rb_funcall((x), id_match, 1, (y))
|
||||
|
||||
#define id_aref rb_intern("[]")
|
||||
#define f_aref(x,y) rb_funcall((x), id_aref, 1, (y))
|
||||
|
||||
#define id_post_match rb_intern("post_match")
|
||||
#define f_post_match(x) rb_funcall((x), id_post_match, 0)
|
||||
|
||||
#define id_gsub_bang rb_intern("gsub!")
|
||||
#define f_gsub_bang(x,y,z) rb_funcall((x), id_gsub_bang, 2, (y), (z))
|
||||
|
||||
|
@ -1470,27 +1464,27 @@ string_to_c_internal(VALUE self)
|
|||
|
||||
m = f_match(comp_pat0, s);
|
||||
if (!NIL_P(m)) {
|
||||
sr = f_aref(m, INT2FIX(1));
|
||||
si = f_aref(m, INT2FIX(2));
|
||||
re = f_post_match(m);
|
||||
po = 1;
|
||||
sr = rb_reg_nth_match(1, m);
|
||||
si = rb_reg_nth_match(2, m);
|
||||
re = rb_reg_match_post(m);
|
||||
po = 1;
|
||||
}
|
||||
if (NIL_P(m)) {
|
||||
m = f_match(comp_pat1, s);
|
||||
if (!NIL_P(m)) {
|
||||
sr = Qnil;
|
||||
si = f_aref(m, INT2FIX(1));
|
||||
si = rb_reg_nth_match(1, m);
|
||||
if (NIL_P(si))
|
||||
si = rb_usascii_str_new2("");
|
||||
{
|
||||
VALUE t;
|
||||
|
||||
t = f_aref(m, INT2FIX(2));
|
||||
t = rb_reg_nth_match(2, m);
|
||||
if (NIL_P(t))
|
||||
t = rb_usascii_str_new2("1");
|
||||
rb_str_concat(si, t);
|
||||
}
|
||||
re = f_post_match(m);
|
||||
re = rb_reg_match_post(m);
|
||||
po = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1498,19 +1492,19 @@ string_to_c_internal(VALUE self)
|
|||
m = f_match(comp_pat2, s);
|
||||
if (NIL_P(m))
|
||||
return rb_assoc_new(Qnil, self);
|
||||
sr = f_aref(m, INT2FIX(1));
|
||||
if (NIL_P(f_aref(m, INT2FIX(2))))
|
||||
sr = rb_reg_nth_match(1, m);
|
||||
if (NIL_P(rb_reg_nth_match(2, m)))
|
||||
si = Qnil;
|
||||
else {
|
||||
VALUE t;
|
||||
|
||||
si = f_aref(m, INT2FIX(3));
|
||||
t = f_aref(m, INT2FIX(4));
|
||||
si = rb_reg_nth_match(3, m);
|
||||
t = rb_reg_nth_match(4, m);
|
||||
if (NIL_P(t))
|
||||
t = rb_usascii_str_new2("1");
|
||||
rb_str_concat(si, t);
|
||||
}
|
||||
re = f_post_match(m);
|
||||
re = rb_reg_match_post(m);
|
||||
po = 0;
|
||||
}
|
||||
r = INT2FIX(0);
|
||||
|
|
14
rational.c
14
rational.c
|
@ -2018,12 +2018,6 @@ make_patterns(void)
|
|||
#define id_match rb_intern("match")
|
||||
#define f_match(x,y) rb_funcall((x), id_match, 1, (y))
|
||||
|
||||
#define id_aref rb_intern("[]")
|
||||
#define f_aref(x,y) rb_funcall((x), id_aref, 1, (y))
|
||||
|
||||
#define id_post_match rb_intern("post_match")
|
||||
#define f_post_match(x) rb_funcall((x), id_post_match, 0)
|
||||
|
||||
#define id_split rb_intern("split")
|
||||
#define f_split(x,y) rb_funcall((x), id_split, 1, (y))
|
||||
|
||||
|
@ -2043,10 +2037,10 @@ string_to_r_internal(VALUE self)
|
|||
|
||||
if (!NIL_P(m)) {
|
||||
VALUE v, ifp, exp, ip, fp;
|
||||
VALUE si = f_aref(m, INT2FIX(1));
|
||||
VALUE nu = f_aref(m, INT2FIX(2));
|
||||
VALUE de = f_aref(m, INT2FIX(3));
|
||||
VALUE re = f_post_match(m);
|
||||
VALUE si = rb_reg_nth_match(1, m);
|
||||
VALUE nu = rb_reg_nth_match(2, m);
|
||||
VALUE de = rb_reg_nth_match(3, m);
|
||||
VALUE re = rb_reg_match_post(m);
|
||||
|
||||
{
|
||||
VALUE a;
|
||||
|
|
Загрузка…
Ссылка в новой задаче