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

ruby-changes:5613

From: shyouhei <ko1@a...>
Date: Fri, 13 Jun 2008 11:53:00 +0900 (JST)
Subject: [ruby-changes:5613] Ruby:r17119 (ruby_1_8_6): merge revision(s) 15287:

shyouhei	2008-06-13 11:52:46 +0900 (Fri, 13 Jun 2008)

  New Revision: 17119

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/io.c
    branches/ruby_1_8_6/version.h

  Log:
    merge revision(s) 15287:
    * io.c (rb_open_file): should check NUL in path.
      <http://www.rubyist.net/~matz/20080125.html#c01>.
    * io.c (rb_io_s_popen): ditto.
    * io.c (rb_io_reopen): ditto.
    * io.c (next_argv): ditto.
    * io.c (rb_io_s_foreach): ditto.
    * io.c (rb_io_s_readlines): ditto.
    * io.c (rb_io_s_read): ditto.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/ChangeLog?r1=17119&r2=17118&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/version.h?r1=17119&r2=17118&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/io.c?r1=17119&r2=17118&diff_format=u

Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 17118)
+++ ruby_1_8_6/ChangeLog	(revision 17119)
@@ -1,3 +1,20 @@
+Fri Jun 13 11:50:59 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* io.c (rb_open_file): should check NUL in path.
+	  <http://www.rubyist.net/~matz/20080125.html#c01>.
+
+	* io.c (rb_io_s_popen): ditto.
+
+	* io.c (rb_io_reopen): ditto.
+
+	* io.c (next_argv): ditto.
+
+	* io.c (rb_io_s_foreach): ditto.
+
+	* io.c (rb_io_s_readlines): ditto.
+
+	* io.c (rb_io_s_read): ditto.
+
 Wed Jun 11 15:23:13 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/uri/generic.rb (URI::Generic::inspect): use Kernel#to_s instead
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 17118)
+++ ruby_1_8_6/version.h	(revision 17119)
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.6"
-#define RUBY_RELEASE_DATE "2008-06-11"
+#define RUBY_RELEASE_DATE "2008-06-13"
 #define RUBY_VERSION_CODE 186
-#define RUBY_RELEASE_CODE 20080611
-#define RUBY_PATCHLEVEL 169
+#define RUBY_RELEASE_CODE 20080613
+#define RUBY_PATCHLEVEL 170
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 6
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 11
+#define RUBY_RELEASE_DAY 13
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8_6/io.c
===================================================================
--- ruby_1_8_6/io.c	(revision 17118)
+++ ruby_1_8_6/io.c	(revision 17119)
@@ -3256,7 +3256,7 @@
 	mode = rb_io_modenum_mode(FIX2INT(pmode));
     }
     else {
-	mode = rb_io_flags_mode(rb_io_mode_flags(StringValuePtr(pmode)));
+	mode = rb_io_flags_mode(rb_io_mode_flags(StringValueCStr(pmode)));
     }
     SafeStringValue(pname);
     port = pipe_open(pname, 0, mode);
@@ -3284,12 +3284,13 @@
     VALUE io;
 {
     VALUE fname, vmode, perm;
-    char *mode;
+    char *path, *mode;
     int flags, fmode;
 
     rb_scan_args(argc, argv, "12", &fname, &vmode, &perm);
     SafeStringValue(fname);
 
+    path = StringValueCStr(fname);
     if (FIXNUM_P(vmode) || !NIL_P(perm)) {
 	if (FIXNUM_P(vmode)) {
 	    flags = FIX2INT(vmode);
@@ -3300,11 +3301,11 @@
 	}
 	fmode = NIL_P(perm) ? 0666 :  NUM2INT(perm);
 
-	rb_file_sysopen_internal(io, RSTRING(fname)->ptr, flags, fmode);
+	rb_file_sysopen_internal(io, path, flags, fmode);
     }
     else {
-	mode = NIL_P(vmode) ? "r" : StringValuePtr(vmode);
-	rb_file_open_internal(io, RSTRING(fname)->ptr, mode);
+	mode = NIL_P(vmode) ? "r" : StringValueCStr(vmode);
+	rb_file_open_internal(io, path, mode);
     }
     return io;
 }
@@ -3657,7 +3658,7 @@
     }
 
     if (!NIL_P(nmode)) {
-	fptr->mode = rb_io_mode_flags(StringValuePtr(nmode));
+	fptr->mode = rb_io_mode_flags(StringValueCStr(nmode));
     }
 
     if (fptr->path) {
@@ -3665,7 +3666,7 @@
 	fptr->path = 0;
     }
 
-    fptr->path = strdup(RSTRING(fname)->ptr);
+    fptr->path = strdup(StringValueCStr(fname));
     mode = rb_io_flags_mode(fptr->mode);
     if (!fptr->f) {
 	fptr->f = rb_fopen(fptr->path, mode);
@@ -3676,16 +3677,16 @@
 	return file;
     }
 
-    if (freopen(RSTRING(fname)->ptr, mode, fptr->f) == 0) {
+    if (freopen(fptr->path, mode, fptr->f) == 0) {
 	rb_sys_fail(fptr->path);
     }
 #ifdef USE_SETVBUF
     if (setvbuf(fptr->f, NULL, _IOFBF, 0) != 0)
-	rb_warn("setvbuf() can't be honoured for %s", RSTRING(fname)->ptr);
+	rb_warn("setvbuf() can't be honoured for %s", fptr->path);
 #endif
 
     if (fptr->f2) {
-	if (freopen(RSTRING(fname)->ptr, "w", fptr->f2) == 0) {
+	if (freopen(fptr->path, "w", fptr->f2) == 0) {
 	    rb_sys_fail(fptr->path);
 	}
     }
@@ -4234,7 +4235,7 @@
 	}
 	else {
 	    SafeStringValue(mode);
-	    flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
+	    flags = rb_io_mode_modenum(StringValueCStr(mode));
 	}
     }
     else {
@@ -4404,7 +4405,7 @@
       retry:
 	if (RARRAY(rb_argv)->len > 0) {
 	    filename = rb_ary_shift(rb_argv);
-	    fn = StringValuePtr(filename);
+	    fn = StringValueCStr(filename);
 	    if (strlen(fn) == 1 && fn[0] == '-') {
 		current_file = rb_stdin;
 		if (ruby_inplace_mode) {
@@ -5065,7 +5066,7 @@
 	if (!NIL_P(v)) {
 	    StringValue(v);
 	    rb_str_modify(v);
-	    arg[i] = (unsigned long)RSTRING(v)->ptr;
+	    arg[i] = (unsigned long)StringValueCStr(v);
 	}
 	else {
 	    arg[i] = (unsigned long)NUM2LONG(*argv);
@@ -5273,7 +5274,7 @@
     else if (!NIL_P(arg.sep)) {
 	StringValue(arg.sep);
     }
-    arg.io = rb_io_open(RSTRING(fname)->ptr, "r");
+    arg.io = rb_io_open(StringValueCStr(fname), "r");
     if (NIL_P(arg.io)) return Qnil;
 
     return rb_ensure(io_s_foreach, (VALUE)&arg, rb_io_close, arg.io);
@@ -5312,7 +5313,7 @@
     SafeStringValue(fname);
 
     arg.argc = argc - 1;
-    arg.io = rb_io_open(RSTRING(fname)->ptr, "r");
+    arg.io = rb_io_open(StringValueCStr(fname), "r");
     if (NIL_P(arg.io)) return Qnil;
     return rb_ensure(io_s_readlines, (VALUE)&arg, rb_io_close, arg.io);
 }
@@ -5350,7 +5351,7 @@
     SafeStringValue(fname);
 
     arg.argc = argc ? 1 : 0;
-    arg.io = rb_io_open(RSTRING(fname)->ptr, "r");
+    arg.io = rb_io_open(StringValueCStr(fname), "r");
     if (NIL_P(arg.io)) return Qnil;
     if (!NIL_P(offset)) {
 	rb_io_seek(arg.io, offset, SEEK_SET);
@@ -5626,7 +5627,7 @@
     StringValue(val);
     if (ruby_inplace_mode) free(ruby_inplace_mode);
     ruby_inplace_mode = 0;
-    ruby_inplace_mode = strdup(RSTRING(val)->ptr);
+    ruby_inplace_mode = strdup(StringValueCStr(val));
 }
 
 /*

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

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