summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ext/zlib/zlib.c2
-rw-r--r--include/ruby/intern.h1
-rw-r--r--io.c6
4 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 24788d0f2c..87e48a48e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Sep 4 23:42:42 2008 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_file_open_str): declared.
+
+ * io.c (rb_file_open_str): defined.
+
+ * ext/zlib/zlib.c (gzfile_s_open): use rb_file_open_str instead of
+ rb_file_open.
+
Thu Sep 4 23:18:55 2008 Tanaka Akira <akr@fsij.org>
* enc/trans/newline.trans: record newline types met in universal
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 636ec325ce..9bb8f33344 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2294,7 +2294,7 @@ gzfile_s_open(int argc, VALUE *argv, VALUE klass, const char *mode)
}
filename = argv[0];
FilePathValue(filename);
- io = rb_file_open(RSTRING_PTR(filename), mode);
+ io = rb_file_open_str(filename, mode);
argv[0] = io;
return rb_gzfile_s_wrap(argc, argv, klass);
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 95e70c52be..a2010bb327 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -387,6 +387,7 @@ VALUE rb_io_print(int, VALUE*, VALUE);
VALUE rb_io_puts(int, VALUE*, VALUE);
VALUE rb_io_fdopen(int, int, const char*);
VALUE rb_file_open(const char*, const char*);
+VALUE rb_file_open_str(VALUE, const char*);
VALUE rb_gets(void);
void rb_write_error(const char*);
void rb_write_error2(const char*, long);
diff --git a/io.c b/io.c
index 4c8f41a924..ced821a6b5 100644
--- a/io.c
+++ b/io.c
@@ -4051,6 +4051,12 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *mode)
}
VALUE
+rb_file_open_str(VALUE fname, const char *mode)
+{
+ return rb_file_open_internal(io_alloc(rb_cFile), fname, mode);
+}
+
+VALUE
rb_file_open(const char *fname, const char *mode)
{
return rb_file_open_internal(io_alloc(rb_cFile), rb_str_new_cstr(fname), mode);