From d7d6e51dd3c34fd1ab72591e75a0b3950ce3923e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 22 May 2010 17:18:14 -0700 Subject: [PATCH] "Splice" should be a module, not a class We never create IO::Splice objects :x --- ext/io_splice/io_splice_ext.c | 12 ++++++------ lib/io/splice.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/io_splice/io_splice_ext.c b/ext/io_splice/io_splice_ext.c index ab092eb..0679273 100644 --- a/ext/io_splice/io_splice_ext.c +++ b/ext/io_splice/io_splice_ext.c @@ -277,7 +277,7 @@ static VALUE my_vmsplice(VALUE self, VALUE fd, VALUE data, VALUE flags) void Init_io_splice_ext(void) { - VALUE cSplice = rb_define_class_under(rb_cIO, "Splice", rb_cObject); + VALUE mSplice = rb_define_module_under(rb_cIO, "Splice"); rb_define_singleton_method(rb_cIO, "splice", my_splice, 6); rb_define_singleton_method(rb_cIO, "tee", my_tee, 4); @@ -288,32 +288,32 @@ void Init_io_splice_ext(void) * and support for it was removed in Linux 2.6.21 and has not been * readded as of 2.6.30. */ - rb_define_const(cSplice, "F_MOVE", UINT2NUM(SPLICE_F_MOVE)); + rb_define_const(mSplice, "F_MOVE", UINT2NUM(SPLICE_F_MOVE)); /* * Do not block on I/O. This flag only affects the pipe(s) being * spliced from/to and has no effect on the non-pipe descriptor * (which requires non-blocking operation to be set explicitly). */ - rb_define_const(cSplice, "F_NONBLOCK", UINT2NUM(SPLICE_F_NONBLOCK)); + rb_define_const(mSplice, "F_NONBLOCK", UINT2NUM(SPLICE_F_NONBLOCK)); /* * Indicate that there may be more data coming into the outbound * descriptor. This can allow the kernel to avoid sending partial * frames from sockets. Currently only used with splice. */ - rb_define_const(cSplice, "F_MORE", UINT2NUM(SPLICE_F_MORE)); + rb_define_const(mSplice, "F_MORE", UINT2NUM(SPLICE_F_MORE)); /* * Only usable by vmsplice. This flag probably not useful in the * context of Ruby applications which cannot control alignment. */ - rb_define_const(cSplice, "F_GIFT", UINT2NUM(SPLICE_F_GIFT)); + rb_define_const(mSplice, "F_GIFT", UINT2NUM(SPLICE_F_GIFT)); /* * The maximum size of an atomic write to a pipe * POSIX requires this to be at least 512 bytes. * Under Linux, this is 4096 bytes. */ - rb_define_const(cSplice, "PIPE_BUF", UINT2NUM(PIPE_BUF)); + rb_define_const(mSplice, "PIPE_BUF", UINT2NUM(PIPE_BUF)); } diff --git a/lib/io/splice.rb b/lib/io/splice.rb index a193981..6d2db5b 100644 --- a/lib/io/splice.rb +++ b/lib/io/splice.rb @@ -3,7 +3,7 @@ require 'io_splice_ext' class IO - class Splice + module Splice # the version of IO::Splice, currently 0.1.0 VERSION = '0.1.0' -- 2.11.4.GIT