summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-22 21:09:23 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-22 21:09:23 +0000
commitb788dc0af08d2485e326a1ba79048d97d8bc1081 (patch)
tree1e68fc7a4bfd25b24a131be7b6431d37a5f9fb24
parent4dadadeeb1fe02e2e2d52054fcea09e72ac77c65 (diff)
* ext/stringio/stringio.c (strio_init): separate from strio_initialize
to share with strio_reopen properly. [ruby-Bugs-13919] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@13489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/stringio/stringio.c20
-rw-r--r--version.h2
3 files changed, 22 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 29a7a09210..bb5060f1a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Sep 23 06:08:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_init): separate from strio_initialize
+ to share with strio_reopen properly. [ruby-Bugs-13919]
+
Sun Sep 23 05:42:35 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
* lib/rdoc/options.rb (Options::check_diagram): dot -V output
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 09867009b5..fcc596d5f0 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -136,6 +136,7 @@ check_modifiable(ptr)
static VALUE strio_s_allocate _((VALUE));
static VALUE strio_s_open _((int, VALUE *, VALUE));
+static void strio_init _((int, VALUE *, struct StringIO *));
static VALUE strio_initialize _((int, VALUE *, VALUE));
static VALUE strio_finalize _((VALUE));
static VALUE strio_self _((VALUE));
@@ -217,13 +218,24 @@ strio_initialize(argc, argv, self)
VALUE self;
{
struct StringIO *ptr = check_strio(self);
- VALUE string, mode;
- int trunc = Qfalse;
if (!ptr) {
DATA_PTR(self) = ptr = strio_alloc();
}
rb_call_super(0, 0);
+ strio_init(argc, argv, ptr);
+ return self;
+}
+
+static void
+strio_init(argc, argv, ptr)
+ int argc;
+ VALUE *argv;
+ struct StringIO *ptr;
+{
+ VALUE string, mode;
+ int trunc = Qfalse;
+
switch (rb_scan_args(argc, argv, "02", &string, &mode)) {
case 2:
if (FIXNUM_P(mode)) {
@@ -255,7 +267,6 @@ strio_initialize(argc, argv, self)
break;
}
ptr->string = string;
- return self;
}
static VALUE
@@ -570,7 +581,8 @@ strio_reopen(argc, argv, self)
if (argc == 1 && TYPE(*argv) != T_STRING) {
return strio_copy(self, *argv);
}
- return strio_initialize(argc, argv, self);
+ strio_init(argc, argv, StringIO(self));
+ return self;
}
/*
diff --git a/version.h b/version.h
index 718bf1a824..1bc8d73ec8 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2007-09-23"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20070923
-#define RUBY_PATCHLEVEL 112
+#define RUBY_PATCHLEVEL 113
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8