summaryrefslogtreecommitdiff
path: root/ext/io/console
diff options
context:
space:
mode:
Diffstat (limited to 'ext/io/console')
-rw-r--r--ext/io/console/console.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index fd3f03b6b4..17fee11672 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -718,13 +718,12 @@ console_key_pressed_p(VALUE io, VALUE k)
}
else {
const struct vktable *t;
+ const char *kn;
if (SYMBOL_P(k)) {
k = rb_sym2str(k);
}
- else {
- StringValueCStr(k);
- }
- t = console_win32_vk(RSTRING_PTR(k), RSTRING_LEN(k));
+ kn = StringValueCStr(k);
+ t = console_win32_vk(kn, RSTRING_LEN(k));
if (!t || (vk = (short)t->vk) == -1) {
rb_raise(rb_eArgError, "unknown virtual key code: %"PRIsVALUE, k);
}