summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ruby/io.h40
1 files changed, 5 insertions, 35 deletions
diff --git a/include/ruby/io.h b/include/ruby/io.h
index f71176043f..488a092004 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -119,49 +119,19 @@ typedef struct rb_io_t {
#define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr)
#define RB_IO_BUFFER_INIT(buf) do {\
- (buf).ptr = NULL;\
- (buf).off = 0;\
- (buf).len = 0;\
- (buf).capa = 0;\
+ [<"internal macro RB_IO_BUFFER_INIT() is used">];\
} while (0)
#define MakeOpenFile(obj, fp) do {\
- if (RFILE(obj)->fptr) {\
- rb_io_close(obj);\
- rb_io_fptr_finalize(RFILE(obj)->fptr);\
- RFILE(obj)->fptr = 0;\
- }\
- (fp) = 0;\
- RB_IO_FPTR_NEW(fp);\
- RFILE(obj)->fptr = (fp);\
+ (fp) = rb_io_make_open_file(obj);\
} while (0)
#define RB_IO_FPTR_NEW(fp) do {\
- (fp) = ALLOC(rb_io_t);\
- (fp)->fd = -1;\
- (fp)->stdio_file = NULL;\
- (fp)->mode = 0;\
- (fp)->pid = 0;\
- (fp)->lineno = 0;\
- (fp)->pathv = Qnil;\
- (fp)->finalize = 0;\
- RB_IO_BUFFER_INIT((fp)->wbuf);\
- RB_IO_BUFFER_INIT((fp)->rbuf);\
- RB_IO_BUFFER_INIT((fp)->cbuf);\
- (fp)->readconv = NULL;\
- (fp)->writeconv = NULL;\
- (fp)->writeconv_asciicompat = Qnil;\
- (fp)->writeconv_pre_ecflags = 0;\
- (fp)->writeconv_pre_ecopts = Qnil;\
- (fp)->writeconv_initialized = 0;\
- (fp)->tied_io_for_writing = 0;\
- (fp)->encs.enc = NULL;\
- (fp)->encs.enc2 = NULL;\
- (fp)->encs.ecflags = 0;\
- (fp)->encs.ecopts = Qnil;\
- (fp)->write_lock = 0;\
+ [<"internal macro RB_IO_FPTR_NEW() is used">];\
} while (0)
+rb_io_t *rb_io_make_open_file(VALUE obj);
+
FILE *rb_io_stdio_file(rb_io_t *fptr);
FILE *rb_fdopen(int, const char*);