mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (io_encoding_set): don't need argc argument.
(rb_io_s_pipe): update io_encoding_set call. (rb_io_set_encoding): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a3fc5be05
commit
4dcf54aea1
2 changed files with 11 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Sep 13 19:27:01 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* io.c (io_encoding_set): don't need argc argument.
|
||||||
|
(rb_io_s_pipe): update io_encoding_set call.
|
||||||
|
(rb_io_set_encoding): ditto.
|
||||||
|
|
||||||
Sat Sep 13 18:46:41 2008 Tanaka Akira <akr@fsij.org>
|
Sat Sep 13 18:46:41 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* transcode.c (rb_transcoding): align state field.
|
* transcode.c (rb_transcoding): align state field.
|
||||||
|
|
12
io.c
12
io.c
|
@ -6629,20 +6629,18 @@ io_new_instance(VALUE args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
io_encoding_set(rb_io_t *fptr, int argc, VALUE v1, VALUE v2, VALUE opt)
|
io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
|
||||||
{
|
{
|
||||||
rb_encoding *enc, *enc2;
|
rb_encoding *enc, *enc2;
|
||||||
int ecflags;
|
int ecflags;
|
||||||
VALUE ecopts;
|
VALUE ecopts;
|
||||||
|
|
||||||
if (NIL_P(v2)) argc = 1;
|
if (!NIL_P(v2)) {
|
||||||
|
|
||||||
if (argc == 2) {
|
|
||||||
enc2 = rb_to_encoding(v1);
|
enc2 = rb_to_encoding(v1);
|
||||||
enc = rb_to_encoding(v2);
|
enc = rb_to_encoding(v2);
|
||||||
ecflags = rb_econv_prepare_opts(opt, &ecopts);
|
ecflags = rb_econv_prepare_opts(opt, &ecopts);
|
||||||
}
|
}
|
||||||
else if (argc == 1) {
|
else {
|
||||||
if (NIL_P(v1)) {
|
if (NIL_P(v1)) {
|
||||||
enc = NULL;
|
enc = NULL;
|
||||||
enc2 = NULL;
|
enc2 = NULL;
|
||||||
|
@ -6750,7 +6748,7 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
|
||||||
rb_jump_tag(state);
|
rb_jump_tag(state);
|
||||||
}
|
}
|
||||||
GetOpenFile(r, fptr);
|
GetOpenFile(r, fptr);
|
||||||
io_encoding_set(fptr, argc, v1, v2, opt);
|
io_encoding_set(fptr, v1, v2, opt);
|
||||||
args[1] = INT2NUM(pipes[1]);
|
args[1] = INT2NUM(pipes[1]);
|
||||||
args[2] = INT2FIX(O_WRONLY);
|
args[2] = INT2FIX(O_WRONLY);
|
||||||
w = rb_protect(io_new_instance, (VALUE)args, &state);
|
w = rb_protect(io_new_instance, (VALUE)args, &state);
|
||||||
|
@ -7574,7 +7572,7 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io)
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, &argv);
|
||||||
rb_scan_args(argc, argv, "11", &v1, &v2);
|
rb_scan_args(argc, argv, "11", &v1, &v2);
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
io_encoding_set(fptr, argc, v1, v2, opt);
|
io_encoding_set(fptr, v1, v2, opt);
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue