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

* marshal.c (marshal_dump): initializes dump_arg before any funcall.

[ruby-dev:36648]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-10-01 09:57:38 +00:00
parent 46417dafab
commit 7558136984
2 changed files with 24 additions and 17 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 1 18:57:31 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (marshal_dump): initializes dump_arg before any funcall.
[ruby-dev:36648]
Wed Oct 1 00:54:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_split_m): should use rb_str_subseq() which use

View file

@ -865,29 +865,30 @@ marshal_dump(int argc, VALUE *argv)
else port = a1;
}
arg.dest = 0;
if (!NIL_P(port)) {
if (!rb_respond_to(port, s_write)) {
type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.str = rb_str_buf_new(0);
arg.dest = port;
if (rb_respond_to(port, s_binmode)) {
rb_funcall2(port, s_binmode, 0, 0);
}
}
else {
port = rb_str_buf_new(0);
arg.str = port;
}
arg.symbols = st_init_numtable();
arg.data = st_init_numtable();
arg.taint = Qfalse;
arg.untrust = Qfalse;
arg.compat_tbl = st_init_numtable();
arg.wrapper = Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, &arg);
arg.encodings = 0;
arg.str = rb_str_buf_new(0);
RBASIC(arg.str)->klass = 0;
arg.wrapper = Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, &arg);
if (!NIL_P(port)) {
if (!rb_respond_to(port, s_write)) {
type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.dest = port;
if (rb_respond_to(port, s_binmode)) {
rb_funcall2(port, s_binmode, 0, 0);
check_dump_arg(&arg, s_dump_data);
}
}
else {
port = arg.str;
}
c_arg.obj = obj;
c_arg.arg = &arg;
c_arg.limit = limit;
@ -896,6 +897,7 @@ marshal_dump(int argc, VALUE *argv)
w_byte(MARSHAL_MINOR, &arg);
rb_ensure(dump, (VALUE)&c_arg, dump_ensure, (VALUE)&arg);
RBASIC(arg.str)->klass = rb_cString;
return port;
}