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

ruby-changes:10690

From: nobu <ko1@a...>
Date: Thu, 12 Feb 2009 17:18:06 +0900 (JST)
Subject: [ruby-changes:10690] Ruby:r22253 (trunk): * ext/stringio/stringio.c (strio_ungetc): calculates new position

nobu	2009-02-12 17:17:53 +0900 (Thu, 12 Feb 2009)

  New Revision: 22253

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22253

  Log:
    * ext/stringio/stringio.c (strio_ungetc): calculates new position
      before reallocation.  [Bug#1099]

  Modified files:
    trunk/ChangeLog
    trunk/ext/stringio/stringio.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22252)
+++ ChangeLog	(revision 22253)
@@ -1,3 +1,8 @@
+Thu Feb 12 17:17:51 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/stringio/stringio.c (strio_ungetc): calculates new position
+	  before reallocation.  [Bug#1099]
+
 Thu Feb 12 16:50:27 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in: a patch to build on GNU/kOpenSolaris from Rober
Index: ext/stringio/stringio.c
===================================================================
--- ext/stringio/stringio.c	(revision 22252)
+++ ext/stringio/stringio.c	(revision 22253)
@@ -728,8 +728,9 @@
 	p += clen;
 	lpos++;
     }
+    clen = p - RSTRING_PTR(ptr->string);
     rb_str_update(ptr->string, lpos, ptr->pos ? 1 : 0, c);
-    ptr->pos = p - RSTRING_PTR(ptr->string);
+    ptr->pos = clen;
 
     return Qnil;
 }

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

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