1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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/trunk@13482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-09-21 20:19:51 +00:00
parent 80eba73d6a
commit 2f4951f01e
3 changed files with 21 additions and 7 deletions

View file

@ -1,3 +1,8 @@
Sat Sep 22 05:19:49 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]
Fri Sep 21 14:51:40 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (gc_mark_rest): copy just used part.

View file

@ -30,6 +30,7 @@ struct StringIO {
static void strio_mark _((struct StringIO *));
static void strio_free _((struct StringIO *));
static void strio_init(int, VALUE *, struct StringIO *);
#define IS_STRIO(obj) (RDATA(obj)->dmark == (RUBY_DATA_FUNC)strio_mark)
#define error_inval(msg) (errno = EINVAL, rb_sys_fail(msg))
@ -146,13 +147,21 @@ static VALUE
strio_initialize(int argc, VALUE *argv, 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(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)) {
@ -184,7 +193,6 @@ strio_initialize(int argc, VALUE *argv, VALUE self)
break;
}
ptr->string = string;
return self;
}
static VALUE
@ -490,7 +498,8 @@ strio_reopen(int argc, VALUE *argv, VALUE 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;
}
/*

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-09-21"
#define RUBY_RELEASE_DATE "2007-09-22"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070921
#define RUBY_RELEASE_CODE 20070922
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 9
#define RUBY_RELEASE_DAY 21
#define RUBY_RELEASE_DAY 22
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];