[前][次][番号順一覧][スレッド一覧]

ruby-changes:7806

From: akr <ko1@a...>
Date: Sat, 13 Sep 2008 19:32:08 +0900 (JST)
Subject: [ruby-changes:7806] Ruby:r19327 (trunk): * io.c (io_encoding_set): don't need argc argument.

akr	2008-09-13 19:28:06 +0900 (Sat, 13 Sep 2008)

  New Revision: 19327

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19327

  Log:
    * io.c (io_encoding_set): don't need argc argument.
      (rb_io_s_pipe): update io_encoding_set call.
      (rb_io_set_encoding): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19326)
+++ ChangeLog	(revision 19327)
@@ -1,3 +1,9 @@
+Sat Sep 13 19:27:01 2008  Tanaka Akira  <akr@f...>
+
+	* 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@f...>
 
 	* transcode.c (rb_transcoding): align state field.
Index: io.c
===================================================================
--- io.c	(revision 19326)
+++ io.c	(revision 19327)
@@ -6629,20 +6629,18 @@
 }
 
 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;
     int ecflags;
     VALUE ecopts;
 
-    if (NIL_P(v2)) argc = 1;
-
-    if (argc == 2) {
+    if (!NIL_P(v2)) {
 	enc2 = rb_to_encoding(v1);
 	enc = rb_to_encoding(v2);
         ecflags = rb_econv_prepare_opts(opt, &ecopts);
     }
-    else if (argc == 1) {
+    else {
 	if (NIL_P(v1)) {
 	    enc = NULL;
 	    enc2 = NULL;
@@ -6750,7 +6748,7 @@
 	rb_jump_tag(state);
     }
     GetOpenFile(r, fptr);
-    io_encoding_set(fptr, argc, v1, v2, opt);
+    io_encoding_set(fptr, v1, v2, opt);
     args[1] = INT2NUM(pipes[1]);
     args[2] = INT2FIX(O_WRONLY);
     w = rb_protect(io_new_instance, (VALUE)args, &state);
@@ -7574,7 +7572,7 @@
     opt = pop_last_hash(&argc, &argv);
     rb_scan_args(argc, argv, "11", &v1, &v2);
     GetOpenFile(io, fptr);
-    io_encoding_set(fptr, argc, v1, v2, opt);
+    io_encoding_set(fptr, v1, v2, opt);
     return io;
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]