aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-12 08:17:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-12 08:17:53 +0000
commitee159271dd036aef604ddf7687a6923f524b7d70 (patch)
tree705c72fa931cefc43d9930f87713feb2275e27b7
parent9565e98b6e42f50986d3865cd196cce77cb5b182 (diff)
downloadruby-ee159271dd036aef604ddf7687a6923f524b7d70.tar.gz
* ext/stringio/stringio.c (strio_ungetc): calculates new position
before reallocation. [Bug#1099] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/stringio/stringio.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ec4b409322..c9e0005fbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Feb 12 17:17:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_ungetc): calculates new position
+ before reallocation. [Bug#1099]
+
Thu Feb 12 16:50:27 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in: a patch to build on GNU/kOpenSolaris from Rober
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 4ff0e36c69..ce1d55fd46 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;
}