summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-13 02:49:28 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-13 02:49:28 +0000
commit1b98ee79bf5b5eaae865a1f45925b4bf9ac0c11f (patch)
treecbcb5f7628e639f327b99e8f49d7039da5d253b8
parent78fa719573070e4d8c7cba1b1cd055f4cf2f4da7 (diff)
downloadruby-1b98ee79bf5b5eaae865a1f45925b4bf9ac0c11f.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@17116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog23
-rw-r--r--io.c35
-rw-r--r--version.h8
3 files changed, 45 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a315ec86e..ee9e379a88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+Fri Jun 13 11:42:52 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+Sun Jan 27 03:48:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+Sun Jan 27 03:47:51 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+Mon Jan 28 01:21:15 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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:06:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/uri/generic.rb (URI::Generic::inspect): use Kernel#to_s instead
diff --git a/io.c b/io.c
index 0c5172f29f..b59b39c148 100644
--- a/io.c
+++ b/io.c
@@ -3256,7 +3256,7 @@ rb_io_s_popen(argc, argv, klass)
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 @@ rb_open_file(argc, argv, io)
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 @@ rb_open_file(argc, argv, io)
}
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 @@ rb_io_reopen(argc, argv, file)
}
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 @@ rb_io_reopen(argc, argv, file)
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 @@ rb_io_reopen(argc, argv, file)
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 @@ rb_io_initialize(argc, argv, io)
}
else {
SafeStringValue(mode);
- flags = rb_io_mode_modenum(RSTRING(mode)->ptr);
+ flags = rb_io_mode_modenum(StringValueCStr(mode));
}
}
else {
@@ -4404,7 +4405,7 @@ next_argv()
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 @@ rb_f_syscall(argc, argv)
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 @@ rb_io_s_foreach(argc, argv)
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 @@ rb_io_s_readlines(argc, argv, io)
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 @@ rb_io_s_read(argc, argv, io)
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 @@ opt_i_set(val)
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));
}
/*
diff --git a/version.h b/version.h
index 53b6bb7547..9bd1f61794 100644
--- a/version.h
+++ b/version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.5"
-#define RUBY_RELEASE_DATE "2008-06-11"
+#define RUBY_RELEASE_DATE "2008-06-13"
#define RUBY_VERSION_CODE 185
-#define RUBY_RELEASE_CODE 20080611
-#define RUBY_PATCHLEVEL 168
+#define RUBY_RELEASE_CODE 20080613
+#define RUBY_PATCHLEVEL 169
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 5
#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[];