summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-21 12:42:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-21 12:42:39 +0000
commit9d7c3b07eccb295cbffcd029e3ca57168ecb89c3 (patch)
tree75e038b369479f4ff91e677febe7ac495f8a33e5 /io.c
parent3e3b1263946311ba6784179da6542a185312a118 (diff)
downloadruby-9d7c3b07eccb295cbffcd029e3ca57168ecb89c3.tar.gz
ruby-9d7c3b07eccb295cbffcd029e3ca57168ecb89c3.tar.xz
ruby-9d7c3b07eccb295cbffcd029e3ca57168ecb89c3.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@21718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index ee8bf7cb9..5555de7c2 100644
--- a/io.c
+++ b/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;
}