summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-20 07:36:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-20 07:36:01 +0000
commitc8c55db68ae5d78d6926b160f5472712cf68993f (patch)
tree7c38bc0ddd8cb0b16d2f0bca9075afb8f8034d51 /io.c
parente0c5eed65c3b6c4cfb2a922286b1be792ddac58b (diff)
* io.c (rb_io_putc): output via rb_io_write().
* re.c (rb_reg_initialize_m): frozen check should be moved here from rb_reg_initialize(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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;
}