1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/io.h (rb_io_enc_t): rename flags to ecflags.

(rb_io_t): rename writeconv_pre_flags to writeconv_pre_ecflags.
  (MakeOpenFile): follow the renaming.

* io.c: follow the renaming.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-04 10:22:11 +00:00
parent 45c3707303
commit 49e9f42703
3 changed files with 25 additions and 17 deletions

View file

@ -1,3 +1,11 @@
Thu Sep 4 19:20:24 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/io.h (rb_io_enc_t): rename flags to ecflags.
(rb_io_t): rename writeconv_pre_flags to writeconv_pre_ecflags.
(MakeOpenFile): follow the renaming.
* io.c: follow the renaming.
Thu Sep 4 19:10:27 2008 Tanaka Akira <akr@fsij.org> Thu Sep 4 19:10:27 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/encoding.h (ECONV_INVALID_IGNORE): removed because * include/ruby/encoding.h (ECONV_INVALID_IGNORE): removed because

View file

@ -57,7 +57,7 @@ typedef struct rb_io_t {
struct rb_io_enc_t { struct rb_io_enc_t {
rb_encoding *enc; rb_encoding *enc;
rb_encoding *enc2; rb_encoding *enc2;
int flags; int ecflags;
VALUE ecopts; VALUE ecopts;
} encs; } encs;
@ -69,7 +69,7 @@ typedef struct rb_io_t {
rb_econv_t *writeconv; rb_econv_t *writeconv;
VALUE writeconv_stateless; VALUE writeconv_stateless;
int writeconv_pre_flags; int writeconv_pre_ecflags;
VALUE writeconv_pre_ecopts; VALUE writeconv_pre_ecopts;
int writeconv_initialized; int writeconv_initialized;
@ -125,13 +125,13 @@ typedef struct rb_io_t {
fp->cbuf_capa = 0;\ fp->cbuf_capa = 0;\
fp->writeconv = NULL;\ fp->writeconv = NULL;\
fp->writeconv_stateless = Qnil;\ fp->writeconv_stateless = Qnil;\
fp->writeconv_pre_flags = 0;\ fp->writeconv_pre_ecflags = 0;\
fp->writeconv_pre_ecopts = Qnil;\ fp->writeconv_pre_ecopts = Qnil;\
fp->writeconv_initialized = 0;\ fp->writeconv_initialized = 0;\
fp->tied_io_for_writing = 0;\ fp->tied_io_for_writing = 0;\
fp->encs.enc = NULL;\ fp->encs.enc = NULL;\
fp->encs.enc2 = NULL;\ fp->encs.enc2 = NULL;\
fp->encs.flags = 0;\ fp->encs.ecflags = 0;\
fp->encs.ecopts = Qnil;\ fp->encs.ecopts = Qnil;\
} while (0) } while (0)

26
io.c
View file

@ -697,9 +697,9 @@ make_writeconv(rb_io_t *fptr)
/* ECONV_INVALID_XXX and ECONV_UNDEF_XXX should be set both. /* ECONV_INVALID_XXX and ECONV_UNDEF_XXX should be set both.
* But ECONV_CRLF_NEWLINE_ENCODER should be set only for the first. */ * But ECONV_CRLF_NEWLINE_ENCODER should be set only for the first. */
fptr->writeconv_pre_flags = fptr->encs.flags; fptr->writeconv_pre_ecflags = fptr->encs.ecflags;
fptr->writeconv_pre_ecopts = fptr->encs.ecopts; fptr->writeconv_pre_ecopts = fptr->encs.ecopts;
ecflags = fptr->encs.flags; ecflags = fptr->encs.ecflags;
ecopts = fptr->encs.ecopts; ecopts = fptr->encs.ecopts;
#ifdef TEXTMODE_NEWLINE_ENCODER #ifdef TEXTMODE_NEWLINE_ENCODER
@ -714,7 +714,7 @@ make_writeconv(rb_io_t *fptr)
} }
if (NEED_NEWLINE_ENCODER(fptr)) if (NEED_NEWLINE_ENCODER(fptr))
fptr->writeconv_pre_flags |= TEXTMODE_NEWLINE_ENCODER; fptr->writeconv_pre_ecflags |= TEXTMODE_NEWLINE_ENCODER;
#endif #endif
enc = fptr->encs.enc2 ? fptr->encs.enc2 : fptr->encs.enc; enc = fptr->encs.enc2 ? fptr->encs.enc2 : fptr->encs.enc;
@ -757,7 +757,7 @@ io_fwrite(VALUE str, rb_io_t *fptr)
if (!NIL_P(common_encoding)) { if (!NIL_P(common_encoding)) {
str = rb_str_transcode(str, common_encoding, str = rb_str_transcode(str, common_encoding,
fptr->writeconv_pre_flags, fptr->writeconv_pre_ecopts); fptr->writeconv_pre_ecflags, fptr->writeconv_pre_ecopts);
} }
if (fptr->writeconv) { if (fptr->writeconv) {
@ -1444,7 +1444,7 @@ make_readconv(rb_io_t *fptr)
int ecflags; int ecflags;
VALUE ecopts; VALUE ecopts;
const char *sname, *dname; const char *sname, *dname;
ecflags = fptr->encs.flags; ecflags = fptr->encs.ecflags;
ecopts = fptr->encs.ecopts; ecopts = fptr->encs.ecopts;
if (NEED_NEWLINE_DECODER(fptr)) if (NEED_NEWLINE_DECODER(fptr))
ecflags |= ECONV_UNIVERSAL_NEWLINE_DECODER; ecflags |= ECONV_UNIVERSAL_NEWLINE_DECODER;
@ -3906,7 +3906,7 @@ rb_io_extract_modeenc(VALUE *mode_p, VALUE opthash,
*flags_p = flags; *flags_p = flags;
convconfig_p->enc = enc; convconfig_p->enc = enc;
convconfig_p->enc2 = enc2; convconfig_p->enc2 = enc2;
convconfig_p->flags = ecflags; convconfig_p->ecflags = ecflags;
convconfig_p->ecopts = ecopts; convconfig_p->ecopts = ecopts;
} }
@ -4015,7 +4015,7 @@ rb_file_open_generic(VALUE io, VALUE filename, int modenum, int flags, convconfi
else { else {
fptr->encs.enc = NULL; fptr->encs.enc = NULL;
fptr->encs.enc2 = NULL; fptr->encs.enc2 = NULL;
fptr->encs.flags = 0; fptr->encs.ecflags = 0;
fptr->encs.ecopts = Qnil; fptr->encs.ecopts = Qnil;
} }
fptr->pathv = rb_str_new_frozen(filename); fptr->pathv = rb_str_new_frozen(filename);
@ -4038,7 +4038,7 @@ rb_file_open_internal(VALUE io, VALUE filename, const char *mode)
else { else {
convconfig.enc = NULL; convconfig.enc = NULL;
convconfig.enc2 = NULL; convconfig.enc2 = NULL;
convconfig.flags = 0; convconfig.ecflags = 0;
convconfig.ecopts = Qnil; convconfig.ecopts = Qnil;
} }
@ -5024,7 +5024,7 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
} }
fptr->mode = flags; fptr->mode = flags;
rb_io_mode_enc(fptr, StringValueCStr(nmode)); rb_io_mode_enc(fptr, StringValueCStr(nmode));
fptr->encs.flags = 0; fptr->encs.ecflags = 0;
fptr->encs.ecopts = Qnil; fptr->encs.ecopts = Qnil;
} }
@ -6595,14 +6595,14 @@ io_encoding_set(rb_io_t *fptr, int argc, VALUE v1, VALUE v2, VALUE opt)
if (argc == 2) { if (argc == 2) {
fptr->encs.enc2 = rb_to_encoding(v1); fptr->encs.enc2 = rb_to_encoding(v1);
fptr->encs.enc = rb_to_encoding(v2); fptr->encs.enc = rb_to_encoding(v2);
fptr->encs.flags = rb_econv_prepare_opts(opt, &fptr->encs.ecopts); fptr->encs.ecflags = rb_econv_prepare_opts(opt, &fptr->encs.ecopts);
clear_codeconv(fptr); clear_codeconv(fptr);
} }
else if (argc == 1) { else if (argc == 1) {
if (NIL_P(v1)) { if (NIL_P(v1)) {
fptr->encs.enc = NULL; fptr->encs.enc = NULL;
fptr->encs.enc2 = NULL; fptr->encs.enc2 = NULL;
fptr->encs.flags = 0; fptr->encs.ecflags = 0;
fptr->encs.ecopts = Qnil; fptr->encs.ecopts = Qnil;
clear_codeconv(fptr); clear_codeconv(fptr);
} }
@ -6610,12 +6610,12 @@ io_encoding_set(rb_io_t *fptr, int argc, VALUE v1, VALUE v2, VALUE opt)
VALUE tmp = rb_check_string_type(v1); VALUE tmp = rb_check_string_type(v1);
if (!NIL_P(tmp)) { if (!NIL_P(tmp)) {
mode_enc(fptr, StringValueCStr(tmp)); mode_enc(fptr, StringValueCStr(tmp));
fptr->encs.flags = rb_econv_prepare_opts(opt, &fptr->encs.ecopts); fptr->encs.ecflags = rb_econv_prepare_opts(opt, &fptr->encs.ecopts);
} }
else { else {
fptr->encs.enc = rb_to_encoding(v1); fptr->encs.enc = rb_to_encoding(v1);
fptr->encs.enc2 = NULL; fptr->encs.enc2 = NULL;
fptr->encs.flags = 0; fptr->encs.ecflags = 0;
fptr->encs.ecopts = Qnil; fptr->encs.ecopts = Qnil;
clear_codeconv(fptr); clear_codeconv(fptr);
} }