diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-04 05:13:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-04 05:13:18 +0000 |
commit | d15d8f86b63423cd70d30217fb1d9dd534060452 (patch) | |
tree | 4ec81d044c55d6bdb7c883602d8ca388bb55d034 | |
parent | 5bdba7ad0f07258e79edbb02adde27ccb4ad01be (diff) | |
download | ruby-d15d8f86b63423cd70d30217fb1d9dd534060452.tar.gz |
readline.c: fix type
* ext/readline/readline.c (getc_body): fix variable type, and
extract _get_osfhandle.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/readline/readline.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 7356b7f299..ab1b0b2a70 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -164,23 +164,24 @@ getc_body(struct getc_struct *p) #if defined(_WIN32) { INPUT_RECORD ir; - int n; + DWORD n; static int prior_key = '0'; for (;;) { + HANDLE h; if (prior_key > 0xff) { prior_key = rl_getc(p->input); return prior_key; } - if (PeekConsoleInput((HANDLE)_get_osfhandle(p->fd), &ir, 1, &n)) { + h = (HANDLE)_get_osfhandle(p->fd); + if (PeekConsoleInput(h, &ir, 1, &n)) { if (n == 1) { if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) { prior_key = rl_getc(p->input); return prior_key; } else { - ReadConsoleInput((HANDLE)_get_osfhandle(p->fd), &ir, 1, &n); + ReadConsoleInput(h, &ir, 1, &n); } } else { - HANDLE h = (HANDLE)_get_osfhandle(p->fd); rb_w32_wait_events(&h, 1, INFINITE); } } else { |