1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* complex.c (string_to_c_internal): save and restore backref. fixed [ruby-dev:34991]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
wanabe 2008-06-13 08:22:13 +00:00
parent 01d7152157
commit 6fc17f1f7b
2 changed files with 13 additions and 3 deletions

View file

@ -1,4 +1,9 @@
Tue Jun 13 17:06:20 2008 wanabe <s.wanabe@gmail.com> Fri Jun 13 17:20:40 2008 wanabe <s.wanabe@gmail.com>
* complex.c (string_to_c_internal): save and restore backref.
fixed [ruby-dev:34991]
Fri Jun 13 17:06:20 2008 wanabe <s.wanabe@gmail.com>
* rational.c (string_to_r_internal): save and restore backref. * rational.c (string_to_r_internal): save and restore backref.
fixed [ruby-dev:34990] fixed [ruby-dev:34990]

View file

@ -1153,8 +1153,10 @@ string_to_c_internal(VALUE self)
return rb_assoc_new(Qnil, self); return rb_assoc_new(Qnil, self);
{ {
VALUE m, sr, si, re, r, i; VALUE m, sr, si, re, r, i, backref;
backref = rb_backref_get();
rb_match_busy(backref);
m = f_match(comp_pat1, s); m = f_match(comp_pat1, s);
if (!NIL_P(m)) { if (!NIL_P(m)) {
sr = Qnil; sr = Qnil;
@ -1170,8 +1172,10 @@ string_to_c_internal(VALUE self)
} }
if (NIL_P(m)) { if (NIL_P(m)) {
m = f_match(comp_pat2, s); m = f_match(comp_pat2, s);
if (NIL_P(m)) if (NIL_P(m)) {
rb_backref_set(backref);
return rb_assoc_new(Qnil, self); return rb_assoc_new(Qnil, self);
}
sr = f_aref(m, INT2FIX(1)); sr = f_aref(m, INT2FIX(1));
if (NIL_P(f_aref(m, INT2FIX(2)))) if (NIL_P(f_aref(m, INT2FIX(2))))
si = Qnil; si = Qnil;
@ -1206,6 +1210,7 @@ string_to_c_internal(VALUE self)
else else
i = f_to_i(si); i = f_to_i(si);
} }
rb_backref_set(backref);
return rb_assoc_new(rb_complex_new2(r, i), re); return rb_assoc_new(rb_complex_new2(r, i), re);
} }
} }