diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-03-11 16:12:17 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-03-11 16:12:17 -0800 |
commit | af73ca855100a9aadad9bf60de45df62e8aa44e2 (patch) | |
tree | 6423b211b6a9b8f608ddc9aab24b60cb7e61e800 | |
parent | fac0211221d70b94c0301f977e8a6ba429d79ef8 (diff) | |
download | raindrops-af73ca855100a9aadad9bf60de45df62e8aa44e2.tar.gz |
Too hard to maintain.
-rw-r--r-- | ext/raindrops/linux_inet_diag.c | 19 | ||||
-rw-r--r-- | ext/raindrops/rstruct_19.h | 17 |
2 files changed, 1 insertions, 35 deletions
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c index 18f5ce8..7e978f5 100644 --- a/ext/raindrops/linux_inet_diag.c +++ b/ext/raindrops/linux_inet_diag.c @@ -2,15 +2,10 @@ #ifdef __linux__ /* Ruby 1.8.6+ macros (for compatibility with Ruby 1.9) */ -#ifndef RSTRING_PTR -# define RSTRING_PTR(s) (RSTRING(s)->ptr) -#endif #ifndef RSTRING_LEN # define RSTRING_LEN(s) (RSTRING(s)->len) #endif -#include "rstruct_19.h" - /* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */ #ifndef HAVE_RB_THREAD_BLOCKING_REGION # include <rubysig.h> @@ -68,19 +63,10 @@ struct nogvl_args { /* creates a Ruby ListenStats Struct based on our internal listen_stats */ static VALUE rb_listen_stats(struct listen_stats *stats) { - VALUE rv = rb_struct_alloc_noinit(cListenStats); VALUE active = ULONG2NUM(stats->active); VALUE queued = ULONG2NUM(stats->queued); -#ifdef RSTRUCT_PTR - VALUE *ptr = RSTRUCT_PTR(rv); - ptr[0] = active; - ptr[1] = queued; -#else /* Rubinius */ - rb_funcall(rv, rb_intern("active="), 1, active); - rb_funcall(rv, rb_intern("queued="), 1, queued); -#endif /* ! Rubinius */ - return rv; + return rb_struct_new(cListenStats, active, queued); } /* inner loop of inet_diag, called for every socket returned by netlink */ @@ -386,9 +372,6 @@ void Init_raindrops_linux_inet_diag(void) rb_define_module_function(mLinux, "tcp_listener_stats", tcp_listener_stats, 1); -#ifndef HAVE_RB_STRUCT_ALLOC_NOINIT - id_new = rb_intern("new"); -#endif page_size = getpagesize(); assert(OPLEN <= page_size && "bytecode OPLEN is not <= PAGE_SIZE"); diff --git a/ext/raindrops/rstruct_19.h b/ext/raindrops/rstruct_19.h deleted file mode 100644 index f156206..0000000 --- a/ext/raindrops/rstruct_19.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef RSTRUCT -# ifndef RSTRUCT_PTR -# define RSTRUCT_PTR(s) (RSTRUCT(s)->ptr) -# endif -# ifndef RSTRUCT_LEN -# define RSTRUCT_LEN(s) (RSTRUCT(s)->len) -# endif -#endif - - -#ifndef HAVE_RB_STRUCT_ALLOC_NOINIT -static ID id_new; -static VALUE rb_struct_alloc_noinit(VALUE class) -{ - return rb_funcall(class, id_new, 0, 0); -} -#endif /* !defined(HAVE_RB_STRUCT_ALLOC_NOINIT) */ |