summaryrefslogtreecommitdiff
path: root/ext/io
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-16 03:43:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-16 03:43:20 +0000
commitb1cff6b68c4cd4b81c385085aab80a95ea349845 (patch)
tree03a670b6f1decc39c64994925efb0701fc676890 /ext/io
parent8a29d8bbdec15e5f81b75f8ceaca71c618b9ac70 (diff)
console.c: use static IDs
* ext/io/console/console.c (rawmode_opt): prepare static IDs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io')
-rw-r--r--ext/io/console/console.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index e837673..b360090 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -77,7 +77,7 @@ getattr(int fd, conmode *t)
#define SET_LAST_ERROR (0)
#endif
-static ID id_getc, id_console, id_close;
+static ID id_getc, id_console, id_close, id_min, id_time;
#ifndef HAVE_RB_F_SEND
static ID id___send__;
@@ -110,8 +110,8 @@ rawmode_opt(int argc, VALUE *argv, rawmode_arg_t *opts)
VALUE vopts;
rb_scan_args(argc, argv, "0:", &vopts);
if (!NIL_P(vopts)) {
- VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
- VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
+ VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min));
+ VALUE vtime = rb_hash_aref(vopts, ID2SYM(id_time));
/* default values by `stty raw` */
opts->vmin = 1;
opts->vtime = 0;
@@ -751,7 +751,7 @@ console_dev(int argc, VALUE *argv, VALUE klass)
static VALUE
io_getch(int argc, VALUE *argv, VALUE io)
{
- return rb_funcall2(io, rb_intern("getc"), argc, argv);
+ return rb_funcall2(io, id_getc, argc, argv);
}
/*
@@ -764,6 +764,8 @@ Init_console(void)
id_getc = rb_intern("getc");
id_console = rb_intern("console");
id_close = rb_intern("close");
+ id_min = rb_intern("min");
+ id_time = rb_intern("time");
#ifndef HAVE_RB_F_SEND
id___send__ = rb_intern("__send__");
#endif