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

ruby-changes:1996

From: ko1@a...
Date: 23 Sep 2007 06:07:47 +0900
Subject: [ruby-changes:1996] shyouhei - Ruby:r13487 (ruby_1_8_6): * ext/stringio/stringio.c (strio_init): separate from strio_initialize

shyouhei	2007-09-23 06:07:36 +0900 (Sun, 23 Sep 2007)

  New Revision: 13487

  Modified files:
    branches/ruby_1_8_6/ChangeLog
    branches/ruby_1_8_6/ext/stringio/stringio.c
    branches/ruby_1_8_6/version.h

  Log:
    * ext/stringio/stringio.c (strio_init): separate from strio_initialize
      to share with strio_reopen properly.  [ruby-Bugs-13919]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/ChangeLog?r1=13487&r2=13486
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/version.h?r1=13487&r2=13486
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_6/ext/stringio/stringio.c?r1=13487&r2=13486

Index: ruby_1_8_6/ext/stringio/stringio.c
===================================================================
--- ruby_1_8_6/ext/stringio/stringio.c	(revision 13486)
+++ ruby_1_8_6/ext/stringio/stringio.c	(revision 13487)
@@ -136,6 +136,7 @@
 
 static VALUE strio_s_allocate _((VALUE));
 static VALUE strio_s_open _((int, VALUE *, VALUE));
+static void strio_init _((int, VALUE *, struct StringIO *));
 static VALUE strio_initialize _((int, VALUE *, VALUE));
 static VALUE strio_finalize _((VALUE));
 static VALUE strio_self _((VALUE));
@@ -217,13 +218,24 @@
     VALUE self;
 {
     struct StringIO *ptr = check_strio(self);
-    VALUE string, mode;
-    int trunc = Qfalse;
 
     if (!ptr) {
 	DATA_PTR(self) = ptr = strio_alloc();
     }
     rb_call_super(0, 0);
+    strio_init(argc, argv, ptr);
+    return self;
+}
+
+static void
+strio_init(argc, argv, ptr)
+    int argc;
+    VALUE *argv;
+    struct StringIO *ptr;
+{
+    VALUE string, mode;
+    int trunc = Qfalse;
+
     switch (rb_scan_args(argc, argv, "02", &string, &mode)) {
       case 2:
 	if (FIXNUM_P(mode)) {
@@ -255,7 +267,6 @@
 	break;
     }
     ptr->string = string;
-    return self;
 }
 
 static VALUE
@@ -570,7 +581,8 @@
     if (argc == 1 && TYPE(*argv) != T_STRING) {
 	return strio_copy(self, *argv);
     }
-    return strio_initialize(argc, argv, self);
+    strio_init(argc, argv, StringIO(self));
+    return self;
 }
 
 /*
Index: ruby_1_8_6/ChangeLog
===================================================================
--- ruby_1_8_6/ChangeLog	(revision 13486)
+++ ruby_1_8_6/ChangeLog	(revision 13487)
@@ -1,3 +1,8 @@
+Sun Sep 23 06:05:35 2007  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/stringio/stringio.c (strio_init): separate from strio_initialize
+	  to share with strio_reopen properly.  [ruby-Bugs-13919]
+
 Sun Sep 23 05:42:35 2007  URABE Shyouhei  <shyouhei@r...>
 
 	* lib/rdoc/options.rb (Options::check_diagram): dot -V output
Index: ruby_1_8_6/version.h
===================================================================
--- ruby_1_8_6/version.h	(revision 13486)
+++ ruby_1_8_6/version.h	(revision 13487)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2007-09-23"
 #define RUBY_VERSION_CODE 186
 #define RUBY_RELEASE_CODE 20070923
-#define RUBY_PATCHLEVEL 108
+#define RUBY_PATCHLEVEL 109
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8

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

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