From b1cff6b68c4cd4b81c385085aab80a95ea349845 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Feb 2015 03:43:20 +0000 Subject: 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 --- ext/io/console/console.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ext/io/console/console.c') diff --git a/ext/io/console/console.c b/ext/io/console/console.c index e837673cb8..b360090b66 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 -- cgit v1.2.3