summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 14:57:16 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 14:57:16 +0000
commitaaaab31d8b49244c0df11302788e8c5014909e23 (patch)
tree7811243acdb3ef7bb48a9a40ec571f0ebd19bf98 /ext
parentb5490da26bebca87d8bc7baa6b3d97e4b6f580c8 (diff)
* ext/zlib/zlib.c (rb_deflate_initialize, Init_zlib): Fix up
initialize_copy; [ruby-list:45016]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index b971ea76db9..b06ebe3fad1 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1116,10 +1116,12 @@ rb_deflate_initialize(int argc, VALUE *argv, VALUE obj)
static VALUE
rb_deflate_init_copy(VALUE self, VALUE orig)
{
- struct zstream *z1 = get_zstream(self);
- struct zstream *z2 = get_zstream(orig);
+ struct zstream *z1, *z2;
int err;
+ Data_Get_Struct(self, struct zstream, z1);
+ z2 = get_zstream(orig);
+
err = deflateCopy(&z1->stream, &z2->stream);
if (err != Z_OK) {
raise_zlib_error(err, 0);
@@ -3267,7 +3269,7 @@ void Init_zlib()
rb_define_singleton_method(cDeflate, "deflate", rb_deflate_s_deflate, -1);
rb_define_alloc_func(cDeflate, rb_deflate_s_allocate);
rb_define_method(cDeflate, "initialize", rb_deflate_initialize, -1);
- rb_define_method(cDeflate, "initialize_copy", rb_deflate_init_copy, 0);
+ rb_define_method(cDeflate, "initialize_copy", rb_deflate_init_copy, 1);
rb_define_method(cDeflate, "deflate", rb_deflate_deflate, -1);
rb_define_method(cDeflate, "<<", rb_deflate_addstr, 1);
rb_define_method(cDeflate, "flush", rb_deflate_flush, -1);