mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_ungetbyte, rb_io_ungetc): allows nil to reset EOF
flag with ungetting nothing. * ruby.c (load_file_internal): rests EOF flag to make possible to load from stdin after reading data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f0cc645afa
commit
938fcd6b70
3 changed files with 11 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
Wed Jan 21 21:43:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_ungetbyte, rb_io_ungetc): allows nil to reset EOF
|
||||
flag with ungetting nothing.
|
||||
|
||||
* ruby.c (load_file_internal): rests EOF flag to make possible to
|
||||
load from stdin after reading data.
|
||||
|
||||
Wed Jan 21 15:32:15 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag.
|
||||
|
|
4
io.c
4
io.c
|
@ -2860,6 +2860,7 @@ rb_io_ungetbyte(VALUE io, VALUE b)
|
|||
|
||||
GetOpenFile(io, fptr);
|
||||
rb_io_check_readable(fptr);
|
||||
io_unset_eof(fptr);
|
||||
if (NIL_P(b)) return Qnil;
|
||||
if (FIXNUM_P(b)) {
|
||||
char cc = FIX2INT(b);
|
||||
|
@ -2869,7 +2870,6 @@ rb_io_ungetbyte(VALUE io, VALUE b)
|
|||
SafeStringValue(b);
|
||||
}
|
||||
io_ungetbyte(b, fptr);
|
||||
io_unset_eof(fptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -2897,6 +2897,7 @@ rb_io_ungetc(VALUE io, VALUE c)
|
|||
|
||||
GetOpenFile(io, fptr);
|
||||
rb_io_check_readable(fptr);
|
||||
io_unset_eof(fptr);
|
||||
if (NIL_P(c)) return Qnil;
|
||||
if (FIXNUM_P(c)) {
|
||||
int cc = FIX2INT(c);
|
||||
|
@ -2926,7 +2927,6 @@ rb_io_ungetc(VALUE io, VALUE c)
|
|||
else {
|
||||
io_ungetbyte(c, fptr);
|
||||
}
|
||||
io_unset_eof(fptr);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
1
ruby.c
1
ruby.c
|
@ -1581,6 +1581,7 @@ load_file_internal(VALUE arg)
|
|||
rb_io_ungetbyte(f, c);
|
||||
}
|
||||
require_libraries(opt); /* Why here? unnatural */
|
||||
rb_io_ungetbyte(f, Qnil);
|
||||
}
|
||||
if (opt->src.enc.index >= 0) {
|
||||
enc = rb_enc_from_index(opt->src.enc.index);
|
||||
|
|
Loading…
Reference in a new issue