[前][次][番号順一覧][スレッド一覧]

ruby-changes:5640

From: wanabe <ko1@a...>
Date: Fri, 13 Jun 2008 17:20:06 +0900 (JST)
Subject: [ruby-changes:5640] Ruby:r17147 (trunk): * rational.c (string_to_r_internal): save and restore backref. fixed

wanabe	2008-06-13 17:16:12 +0900 (Fri, 13 Jun 2008)

  New Revision: 17147

  Modified files:
    trunk/ChangeLog
    trunk/rational.c

  Log:
    * rational.c (string_to_r_internal): save and restore backref. fixed [ruby-dev:34990]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17147&r2=17146&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/rational.c?r1=17147&r2=17146&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17146)
+++ ChangeLog	(revision 17147)
@@ -1,3 +1,8 @@
+Tue Jun 13 17:06:20 2008  wanabe  <s.wanabe@g...>
+
+	* rational.c (string_to_r_internal): save and restore backref.
+	  fixed [ruby-dev:34990]
+
 Fri Jun 13 14:41:26 2008  NAKAMURA Usaku  <usa@r...>
 
 	* README.EXT.ja: update about Fixnum. reported in
Index: rational.c
===================================================================
--- rational.c	(revision 17146)
+++ rational.c	(revision 17147)
@@ -1274,13 +1274,15 @@
 static VALUE
 string_to_r_internal(VALUE self)
 {
-    VALUE s, m;
+    VALUE s, m, backref;
 
     s = f_strip(self);
 
     if (RSTRING_LEN(s) == 0)
 	return rb_assoc_new(Qnil, self);
 
+    backref = rb_backref_get();
+    rb_match_busy(backref);
     m = f_match(rat_pat, s);
 
     if (!NIL_P(m)) {
@@ -1333,8 +1335,10 @@
 	if (!NIL_P(de))
 	    v = f_div(v, f_to_i(de));
 
+	rb_backref_set(backref);
 	return rb_assoc_new(v, re);
     }
+    rb_backref_set(backref);
     return rb_assoc_new(Qnil, self);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]