* 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
This commit is contained in:
parent
6a9bfa23bf
commit
3b5d60c0b1
@ -1,3 +1,7 @@
|
||||
Sun Mar 2 23:03:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_ungetc): reduce redundant call.
|
||||
|
||||
Sun Mar 2 10:13:12 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (load_file): parse shebang in us-ascii. a patch from
|
||||
|
6
io.c
6
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user