* io.c (rb_io_check_initialized): new function to check uninitialized
object. [ruby-talk:118234] * file.c (rb_file_path), io.c (rb_io_closed): check if initialized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b99f22f196
commit
9f5f676d82
@ -1,3 +1,10 @@
|
|||||||
|
Fri Oct 29 21:27:51 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (rb_io_check_initialized): new function to check uninitialized
|
||||||
|
object. [ruby-talk:118234]
|
||||||
|
|
||||||
|
* file.c (rb_file_path), io.c (rb_io_closed): check if initialized.
|
||||||
|
|
||||||
Fri Oct 29 19:05:33 2004 NARUSE, Yui <naruse@ruby-lang.org>
|
Fri Oct 29 19:05:33 2004 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* ext/nkf: follow nkf2.0.
|
* ext/nkf: follow nkf2.0.
|
||||||
|
1
file.c
1
file.c
@ -138,6 +138,7 @@ rb_file_path(obj)
|
|||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
|
||||||
fptr = RFILE(rb_io_taint_check(obj))->fptr;
|
fptr = RFILE(rb_io_taint_check(obj))->fptr;
|
||||||
|
rb_io_check_initialized(fptr);
|
||||||
if (!fptr->path) return Qnil;
|
if (!fptr->path) return Qnil;
|
||||||
return rb_tainted_str_new2(fptr->path);
|
return rb_tainted_str_new2(fptr->path);
|
||||||
}
|
}
|
||||||
|
10
io.c
10
io.c
@ -182,12 +182,19 @@ rb_io_taint_check(io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_io_check_closed(fptr)
|
rb_io_check_initialized(fptr)
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
{
|
{
|
||||||
if (!fptr) {
|
if (!fptr) {
|
||||||
rb_raise(rb_eIOError, "uninitialized stream");
|
rb_raise(rb_eIOError, "uninitialized stream");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_io_check_closed(fptr)
|
||||||
|
OpenFile *fptr;
|
||||||
|
{
|
||||||
|
rb_io_check_initialized(fptr);
|
||||||
if (!fptr->f && !fptr->f2) {
|
if (!fptr->f && !fptr->f2) {
|
||||||
rb_raise(rb_eIOError, "closed stream");
|
rb_raise(rb_eIOError, "closed stream");
|
||||||
}
|
}
|
||||||
@ -2028,6 +2035,7 @@ rb_io_closed(io)
|
|||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
|
||||||
fptr = RFILE(io)->fptr;
|
fptr = RFILE(io)->fptr;
|
||||||
|
rb_io_check_initialized(fptr);
|
||||||
return (fptr->f || fptr->f2)?Qfalse:Qtrue;
|
return (fptr->f || fptr->f2)?Qfalse:Qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
rubyio.h
1
rubyio.h
@ -69,6 +69,7 @@ void rb_io_check_writable _((OpenFile*));
|
|||||||
void rb_io_check_readable _((OpenFile*));
|
void rb_io_check_readable _((OpenFile*));
|
||||||
int rb_io_fptr_finalize _((OpenFile*));
|
int rb_io_fptr_finalize _((OpenFile*));
|
||||||
void rb_io_synchronized _((OpenFile*));
|
void rb_io_synchronized _((OpenFile*));
|
||||||
|
void rb_io_check_initialized _((OpenFile*));
|
||||||
void rb_io_check_closed _((OpenFile*));
|
void rb_io_check_closed _((OpenFile*));
|
||||||
int rb_io_wait_readable _((int));
|
int rb_io_wait_readable _((int));
|
||||||
int rb_io_wait_writable _((int));
|
int rb_io_wait_writable _((int));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user