From 4295f3d99eccd368e4e08eb9c1d114660e4ea921 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 22 Feb 2009 12:49:06 +0000 Subject: merges r22253 from trunk into ruby_1_9_1. * ext/stringio/stringio.c (strio_ungetc): calculates new position before reallocation. [Bug#1099] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@22531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/stringio/stringio.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5204e5bd4..708ec1209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Feb 12 17:17:51 2009 Nobuyoshi Nakada + + * ext/stringio/stringio.c (strio_ungetc): calculates new position + before reallocation. [Bug#1099] + Mon Feb 9 20:11:55 2009 Nobuyoshi Nakada * ext/win32ole/win32ole.c (load_conv_function51932): fixed for the diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 4ff0e36c6..ce1d55fd4 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -728,8 +728,9 @@ strio_ungetc(VALUE self, VALUE c) 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; } -- cgit