diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-02 14:04:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-02 14:04:02 +0000 |
commit | 3b5d60c0b1602d4aa2b1183d9842cace91d26a07 (patch) | |
tree | a479afb908b339162ba4196ca4ac35b1c88a4ea9 /io.c | |
parent | 6a9bfa23bf686b29e85d78a1566950a533e4b8a8 (diff) | |
download | ruby-3b5d60c0b1602d4aa2b1183d9842cace91d26a07.tar.gz |
* io.c (rb_io_ungetc): reduce redundant call.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2429,19 +2429,17 @@ rb_io_readbyte(VALUE io) VALUE rb_io_ungetc(VALUE io, VALUE c) { - rb_encoding *enc; rb_io_t *fptr; GetOpenFile(io, fptr); rb_io_check_readable(fptr); if (NIL_P(c)) return Qnil; - enc = io_read_encoding(fptr); if (FIXNUM_P(c)) { int cc = FIX2INT(c); + rb_encoding *enc = io_read_encoding(fptr); char buf[16]; - rb_enc_mbcput(cc, buf, enc); - c = rb_str_new(buf, rb_enc_codelen(cc, enc)); + c = rb_str_new(buf, rb_enc_mbcput(cc, buf, enc)); } else { SafeStringValue(c); |