From 6fc17f1f7b792579360aa9eab2b3b574071bc0d6 Mon Sep 17 00:00:00 2001 From: wanabe Date: Fri, 13 Jun 2008 08:22:13 +0000 Subject: [PATCH] * 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 --- ChangeLog | 7 ++++++- complex.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2c775f3de..039141206f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -Tue Jun 13 17:06:20 2008 wanabe +Fri Jun 13 17:20:40 2008 wanabe + + * complex.c (string_to_c_internal): save and restore backref. + fixed [ruby-dev:34991] + +Fri Jun 13 17:06:20 2008 wanabe * rational.c (string_to_r_internal): save and restore backref. fixed [ruby-dev:34990] diff --git a/complex.c b/complex.c index 1485d13484..935d4d6f2b 100644 --- a/complex.c +++ b/complex.c @@ -1153,8 +1153,10 @@ string_to_c_internal(VALUE 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); if (!NIL_P(m)) { sr = Qnil; @@ -1170,8 +1172,10 @@ string_to_c_internal(VALUE self) } if (NIL_P(m)) { m = f_match(comp_pat2, s); - if (NIL_P(m)) + if (NIL_P(m)) { + rb_backref_set(backref); return rb_assoc_new(Qnil, self); + } sr = f_aref(m, INT2FIX(1)); if (NIL_P(f_aref(m, INT2FIX(2)))) si = Qnil; @@ -1206,6 +1210,7 @@ string_to_c_internal(VALUE self) else i = f_to_i(si); } + rb_backref_set(backref); return rb_assoc_new(rb_complex_new2(r, i), re); } }