Skip to content

Commit b788dc0

Browse files
committed
* 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
1 parent 4dadade commit b788dc0

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Sun Sep 23 06:08:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* ext/stringio/stringio.c (strio_init): separate from strio_initialize
4+
to share with strio_reopen properly. [ruby-Bugs-13919]
5+
16
Sun Sep 23 05:42:35 2007 URABE Shyouhei <shyouhei@ruby-lang.org>
27

38
* lib/rdoc/options.rb (Options::check_diagram): dot -V output

ext/stringio/stringio.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ check_modifiable(ptr)
136136

137137
static VALUE strio_s_allocate _((VALUE));
138138
static VALUE strio_s_open _((int, VALUE *, VALUE));
139+
static void strio_init _((int, VALUE *, struct StringIO *));
139140
static VALUE strio_initialize _((int, VALUE *, VALUE));
140141
static VALUE strio_finalize _((VALUE));
141142
static VALUE strio_self _((VALUE));
@@ -217,13 +218,24 @@ strio_initialize(argc, argv, self)
217218
VALUE self;
218219
{
219220
struct StringIO *ptr = check_strio(self);
220-
VALUE string, mode;
221-
int trunc = Qfalse;
222221

223222
if (!ptr) {
224223
DATA_PTR(self) = ptr = strio_alloc();
225224
}
226225
rb_call_super(0, 0);
226+
strio_init(argc, argv, ptr);
227+
return self;
228+
}
229+
230+
static void
231+
strio_init(argc, argv, ptr)
232+
int argc;
233+
VALUE *argv;
234+
struct StringIO *ptr;
235+
{
236+
VALUE string, mode;
237+
int trunc = Qfalse;
238+
227239
switch (rb_scan_args(argc, argv, "02", &string, &mode)) {
228240
case 2:
229241
if (FIXNUM_P(mode)) {
@@ -255,7 +267,6 @@ strio_initialize(argc, argv, self)
255267
break;
256268
}
257269
ptr->string = string;
258-
return self;
259270
}
260271

261272
static VALUE
@@ -570,7 +581,8 @@ strio_reopen(argc, argv, self)
570581
if (argc == 1 && TYPE(*argv) != T_STRING) {
571582
return strio_copy(self, *argv);
572583
}
573-
return strio_initialize(argc, argv, self);
584+
strio_init(argc, argv, StringIO(self));
585+
return self;
574586
}
575587

576588
/*

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define RUBY_RELEASE_DATE "2007-09-23"
33
#define RUBY_VERSION_CODE 185
44
#define RUBY_RELEASE_CODE 20070923
5-
#define RUBY_PATCHLEVEL 112
5+
#define RUBY_PATCHLEVEL 113
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8

0 commit comments

Comments
 (0)