summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--io.c20
-rw-r--r--iseq.c3
3 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 50b3c4363f..81f2adf6b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Sep 13 03:31:05 2008 Tanaka Akira <akr@fsij.org>
+
+ * iseq.c (iseq_s_compile_file): use rb_file_open_str.
+
+ * io.c (rb_file_open_generic): call validate_enc_binmode.
+ (rb_file_open_str): call FilePathValue.
+
Sat Sep 13 02:58:05 2008 Tanaka Akira <akr@fsij.org>
* io.c (validate_enc_binmode): extracted from rb_io_extract_modeenc.
diff --git a/io.c b/io.c
index 7890bcd77b..af2c7ad0a8 100644
--- a/io.c
+++ b/io.c
@@ -4037,18 +4037,19 @@ static VALUE
rb_file_open_generic(VALUE io, VALUE filename, int oflags, int fmode, convconfig_t *convconfig, mode_t perm)
{
rb_io_t *fptr;
+ convconfig_t cc;
+ if (!convconfig) {
+ cc.enc = NULL;
+ cc.enc2 = NULL;
+ cc.ecflags = 0;
+ cc.ecopts = Qnil;
+ convconfig = &cc;
+ }
+ validate_enc_binmode(fmode, convconfig->enc, convconfig->enc2);
MakeOpenFile(io, fptr);
fptr->mode = fmode;
- if (convconfig) {
- fptr->encs = *convconfig;
- }
- else {
- fptr->encs.enc = NULL;
- fptr->encs.enc2 = NULL;
- fptr->encs.ecflags = 0;
- fptr->encs.ecopts = Qnil;
- }
+ fptr->encs = *convconfig;
fptr->pathv = rb_str_new_frozen(filename);
fptr->fd = rb_sysopen(RSTRING_PTR(fptr->pathv), oflags, perm);
io_check_tty(fptr);
@@ -4084,6 +4085,7 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *modestr)
VALUE
rb_file_open_str(VALUE fname, const char *modestr)
{
+ FilePathValue(fname);
return rb_file_open_internal(io_alloc(rb_cFile), fname, modestr);
}
diff --git a/iseq.c b/iseq.c
index 34d90871d7..057516deed 100644
--- a/iseq.c
+++ b/iseq.c
@@ -500,9 +500,10 @@ iseq_s_compile_file(int argc, VALUE *argv, VALUE self)
rb_secure(1);
rb_scan_args(argc, argv, "11", &file, &opt);
+ FilePathValue(file);
fname = StringValueCStr(file);
- f = rb_file_open(fname, "r");
+ f = rb_file_open_str(file, "r");
parser = rb_parser_new();
node = rb_parser_compile_file(parser, fname, f, NUM2INT(line));