summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/io.c b/io.c
index 8edc5651b6..32203dca49 100644
--- a/io.c
+++ b/io.c
@@ -2381,24 +2381,10 @@ static VALUE
rb_io_putc(io, ch)
VALUE io, ch;
{
- OpenFile *fptr;
- FILE *f;
- int c = NUM2CHR(ch);
-
- rb_secure(4);
- GetOpenFile(io, fptr);
- rb_io_check_writable(fptr);
- f = GetWriteFile(fptr);
-
- if (fputc(c, f) == EOF)
- rb_sys_fail(fptr->path);
- if (fptr->mode & FMODE_SYNC) {
- io_fflush(f, fptr);
- }
- else {
- fptr->mode |= FMODE_WBUF;
- }
-
+ char c[2];
+ c[0] = NUM2CHR(ch);
+ c[1] = '\0';
+ rb_io_write(io, rb_str_new(c, 1));
return ch;
}