зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
207ad0a285
Коммит
965ff82341
|
@ -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.
|
||||
|
|
20
io.c
20
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);
|
||||
}
|
||||
|
||||
|
|
3
iseq.c
3
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));
|
||||
|
|
Загрузка…
Ссылка в новой задаче