summaryrefslogtreecommitdiff
path: root/ext/readline
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-04 05:13:18 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-04 05:13:18 (GMT)
commit1ec805727e7d01b9b9c1976921af36b8571f2f7c (patch)
tree4ec81d044c55d6bdb7c883602d8ca388bb55d034 /ext/readline
parent2e97d5bc429dd6097126a274c3de110c8498a2bf (diff)
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
Diffstat (limited to 'ext/readline')
-rw-r--r--ext/readline/readline.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 7356b7f..ab1b0b2 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 {