about summary refs log tree commit homepage
path: root/ext/sleepy_penguin/eventfd.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-19 21:58:55 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-19 22:08:59 +0000
commit6d61241b5ce1e3baefcbd3379241f55c2af8fa1b (patch)
tree66bdc2226807e6eb4549aa2f9945f848de8d3ad5 /ext/sleepy_penguin/eventfd.c
parent6fd281b29e0e4220719e736bff4ef6d5feb49056 (diff)
downloadsleepy_penguin-6d61241b5ce1e3baefcbd3379241f55c2af8fa1b.tar.gz
It's fewer lines of code and cleaner in cases where "new"
and "for_fd" are the same underlying method.
Diffstat (limited to 'ext/sleepy_penguin/eventfd.c')
-rw-r--r--ext/sleepy_penguin/eventfd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/sleepy_penguin/eventfd.c b/ext/sleepy_penguin/eventfd.c
index d291bff..4da5e45 100644
--- a/ext/sleepy_penguin/eventfd.c
+++ b/ext/sleepy_penguin/eventfd.c
@@ -1,7 +1,6 @@
 #ifdef HAVE_SYS_EVENTFD_H
 #include "sleepy_penguin.h"
 #include <sys/eventfd.h>
-static ID id_for_fd;
 
 /*
  * call-seq:
@@ -21,7 +20,7 @@ static ID id_for_fd;
  */
 static VALUE s_new(int argc, VALUE *argv, VALUE klass)
 {
-        VALUE _initval, _flags;
+        VALUE _initval, _flags, rv;
         unsigned initval;
         int flags;
         int fd;
@@ -40,7 +39,8 @@ static VALUE s_new(int argc, VALUE *argv, VALUE klass)
                         rb_sys_fail("eventfd");
         }
 
-        return rb_funcall(klass, id_for_fd, 1, INT2NUM(fd));
+        rv = INT2FIX(fd);
+        return rb_call_super(1, &rv);
 }
 
 struct efd_args {
@@ -170,6 +170,5 @@ void sleepy_penguin_init_eventfd(void)
 #endif
         rb_define_method(cEventFD, "value", getvalue, -1);
         rb_define_method(cEventFD, "incr", incr, -1);
-        id_for_fd = rb_intern("for_fd");
 }
 #endif /* HAVE_SYS_EVENTFD_H */