[前][次][番号順一覧][スレッド一覧]

ruby-changes:7794

From: akr <ko1@a...>
Date: Sat, 13 Sep 2008 03:32:38 +0900 (JST)
Subject: [ruby-changes:7794] Ruby:r19315 (trunk): * iseq.c (iseq_s_compile_file): use rb_file_open_str.

akr	2008-09-13 03:32:19 +0900 (Sat, 13 Sep 2008)

  New Revision: 19315

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19315

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
    trunk/iseq.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19314)
+++ ChangeLog	(revision 19315)
@@ -1,3 +1,10 @@
+Sat Sep 13 03:31:05 2008  Tanaka Akira  <akr@f...>
+
+	* 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@f...>
 
 	* io.c (validate_enc_binmode): extracted from rb_io_extract_modeenc.
Index: iseq.c
===================================================================
--- iseq.c	(revision 19314)
+++ iseq.c	(revision 19315)
@@ -500,9 +500,10 @@
 
     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));
Index: io.c
===================================================================
--- io.c	(revision 19314)
+++ io.c	(revision 19315)
@@ -4037,18 +4037,19 @@
 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 @@
 VALUE
 rb_file_open_str(VALUE fname, const char *modestr)
 {
+    FilePathValue(fname);
     return rb_file_open_internal(io_alloc(rb_cFile), fname, modestr);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]