summaryrefslogtreecommitdiff
path: root/ext/io/console
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-14 14:47:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-14 14:50:21 +0900
commit29dde62605d50a55933ec5d92bcb6f5f738c390b (patch)
treeaa16f9289923526d5edb8a68b67d0b64b973064d /ext/io/console
parentc1746708233bf90270dca1f698ca3616cc16922c (diff)
io/console: rb_str_cat_conv_enc_opts is not exported
Diffstat (limited to 'ext/io/console')
-rw-r--r--ext/io/console/console.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index b8b36249b7..f10b1e4a15 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -443,14 +443,12 @@ console_getch(int argc, VALUE *argv, VALUE io)
len = 1;
do {
buf[len++] = (unsigned char)c;
- } while ((c >>= CHAR_BIT) && len < sizeof(buf));
+ } while ((c >>= CHAR_BIT) && len < (int)sizeof(buf));
return rb_str_new(buf, len);
default:
len = rb_uv_to_utf8(buf, c);
- str = rb_enc_str_new(0, 0, rb_default_external_encoding());
- rb_str_cat_conv_enc_opts(str, 0, buf, len, rb_utf8_encoding(),
- 0, Qnil);
- return str;
+ str = rb_utf8_str_new(buf, len);
+ return rb_str_conv_enc(str, NULL, rb_default_external_encoding());
}
#endif
}