about summary refs log tree commit homepage
path: root/ext/kgio/read_write.c
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2010-11-05 09:01:08 +0800
committerEric Wong <e@yhbt.net>2010-11-05 09:01:08 +0800
commit2772ed8bfe108b66b7493bc5cb0c40ddeb1ca57d (patch)
treece3fc56917c275628c73caee0acac01c8ef84861 /ext/kgio/read_write.c
parentbf3b507791403811bece9dff915ca10757bca519 (diff)
downloadkgio-2772ed8bfe108b66b7493bc5cb0c40ddeb1ca57d.tar.gz
There's no point in using constants that point to symbols
instead of just the symbols themselves.
Diffstat (limited to 'ext/kgio/read_write.c')
-rw-r--r--ext/kgio/read_write.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/kgio/read_write.c b/ext/kgio/read_write.c
index 890392c..13369ba 100644
--- a/ext/kgio/read_write.c
+++ b/ext/kgio/read_write.c
@@ -1,5 +1,5 @@
 #include "kgio.h"
-static VALUE mKgio_WaitReadable, mKgio_WaitWritable;
+static VALUE sym_wait_readable, sym_wait_writable;
 static VALUE eErrno_EPIPE, eErrno_ECONNRESET;
 
 /*
@@ -74,7 +74,7 @@ static int read_check(struct io_args *a, long n, const char *msg, int io_wait)
                                 a->ptr = RSTRING_PTR(a->buf);
                                 return -1;
                         } else {
-                                a->buf = mKgio_WaitReadable;
+                                a->buf = sym_wait_readable;
                                 return 0;
                         }
                 }
@@ -150,7 +150,7 @@ static VALUE kgio_read_bang(int argc, VALUE *argv, VALUE io)
  *
  * Returns nil on EOF.
  *
- * Returns Kgio::WaitReadable if EAGAIN is encountered.
+ * Returns :wait_readable if EAGAIN is encountered.
  */
 static VALUE kgio_tryread(int argc, VALUE *argv, VALUE io)
 {
@@ -243,7 +243,7 @@ done:
                         } else if (written > 0) {
                                 a->buf = rb_str_new(a->ptr, a->len);
                         } else {
-                                a->buf = mKgio_WaitWritable;
+                                a->buf = sym_wait_writable;
                         }
                         return 0;
                 }
@@ -290,14 +290,14 @@ static VALUE kgio_write(VALUE io, VALUE str)
 /*
  * call-seq:
  *
- *        io.kgio_trywrite(str)        -> nil or Kgio::WaitWritable
+ *        io.kgio_trywrite(str)        -> nil or :wait_writable
  *
  * Returns nil if the write was completed in full.
  *
  * Returns a String containing the unwritten portion if EAGAIN
  * was encountered, but some portion was successfully written.
  *
- * Returns Kgio::WaitWritable if EAGAIN is encountered and nothing
+ * Returns :wait_writable if EAGAIN is encountered and nothing
  * was written.
  */
 static VALUE kgio_trywrite(VALUE io, VALUE str)
@@ -353,8 +353,8 @@ void init_kgio_read_write(void)
         VALUE mPipeMethods, mSocketMethods;
         VALUE mKgio = rb_define_module("Kgio");
 
-        mKgio_WaitReadable = rb_const_get(mKgio, rb_intern("WaitReadable"));
-        mKgio_WaitWritable = rb_const_get(mKgio, rb_intern("WaitWritable"));
+        sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
+        sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
 
         /*
          * Document-module: Kgio::PipeMethods