summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 12:49:06 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 12:49:06 +0000
commit1efaf20e256f37208e5c5b3a4d49dbde3eac6f75 (patch)
tree4bc2596978892dc2ae7d23f00945014c76d0993a /ext
parent3c9aa0e606ccf4991181ba4659d4bb2ec0ba2b72 (diff)
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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@22531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c3
1 files changed, 2 insertions, 1 deletions
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;
}