From 3b5d60c0b1602d4aa2b1183d9842cace91d26a07 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 2 Mar 2008 14:04:02 +0000 Subject: * 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 --- io.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index dad62a45bc..55959802a4 100644 --- a/io.c +++ b/io.c @@ -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); -- cgit v1.2.3