[#39606] [Feature:trunk] Dir instance methods for relative path — Nobuyoshi Nakada <nobu@...>

なかだです。

15 messages 2009/11/02
[#39607] Re: [Feature:trunk] Dir instance methods for relative path — Yukihiro Matsumoto <matz@...> 2009/11/02

まつもと ゆきひろです

[#39611] Re: [Feature:trunk] Dir instance methods for relative path — KOSAKI Motohiro <kosaki.motohiro@...> 2009/11/02

kosakiです

[#39660] [Bug:trunk] Enumerator.new {|y| y << 1 << 2 << 3 } — Yusuke ENDOH <mame@...>

遠藤です。

14 messages 2009/11/11
[#39661] Re: [Bug:trunk] Enumerator.new {|y| y << 1 << 2 << 3 } — Tanaka Akira <akr@...> 2009/11/11

In article <e0b1e5700911110537u2aacf835pc0aea13d89a92cef@mail.gmail.com>,

[#39685] [Feature #2366] private constant — Yusuke Endoh <redmine@...>

Feature #2366: private constant

23 messages 2009/11/14
[#39689] [Feature #2366] private constant — Yusuke Endoh <redmine@...> 2009/11/14

チケット #2366 が更新されました。 (by Yusuke Endoh)

[#40207] Re: [Feature #2366] private constant — Yusuke ENDOH <mame@...> 2010/01/28

遠藤です。

[#40239] Re: [Feature #2366] private constant — Masatoshi SEKI <m_seki@...> 2010/01/29

=1B$B31$H$$$$$^$9!#=1B(B

[#40243] Re: [Feature #2366] private constant — Yusuke ENDOH <mame@...> 2010/01/29

遠藤です。

[#40246] Re: [Feature #2366] private constant — Masatoshi SEKI <m_seki@...> 2010/01/29

=1B$B31$H$$$$$^$9!#=1B(B

[#40247] Re: [Feature #2366] private constant — "NARUSE, Yui" <naruse@...> 2010/01/29

成瀬です。

[#39720] hidden objectって? — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

15 messages 2009/11/18
[#39721] Re: hidden objectって? — Yukihiro Matsumoto <matz@...> 2009/11/18

まつもと ゆきひろです

[#39726] Re: hidden objectって? — keiju@... (石塚圭樹) 2009/11/19

けいじゅ@いしつかです.

[#39727] Re: hidden objectって? — Yukihiro Matsumoto <matz@...> 2009/11/19

まつもと ゆきひろです

[#39730] Re: hidden objectって? — keiju@... (石塚圭樹) 2009/11/19

けいじゅ@いしつかです.

[#39735] [Bug:trunk] r25230 causes SEGV arround Marshal — "NARUSE, Yui" <naruse@...> 2009/11/19

以下のコミット以降、後述の現象が発生するそうです。

[#39755] RbConfig.rubybin — Tanaka Akira <akr@...>

ruby コマンドのパス名を返す RbConfig.rubybin というメソッド

18 messages 2009/11/23
[#39756] Re: RbConfig.rubybin — Kouhei Sutou <kou@...> 2009/11/23

須藤です。

[#39814] Re: RbConfig.rubybin — Tanaka Akira <akr@...> 2009/11/30

In article <20091123.123808.1122146273169400964.kou@cozmixng.org>,

[#39815] Re: RbConfig.rubybin — KOSAKI Motohiro <kosaki.motohiro@...> 2009/11/30

> In article <20091123.123808.1122146273169400964.kou@cozmixng.org>,

[#39796] バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — keiju@... (Keiju ISHITSUKA)

けいじゅ@いしつかです.

14 messages 2009/11/27
[#39800] Re: バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — Yukihiro Matsumoto <matz@...> 2009/11/27

まつもと ゆきひろです

[#39803] Re: バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — keiju@... (石塚圭樹) 2009/11/27

けいじゅ@いしつかです.

[#39805] Re: バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — Yukihiro Matsumoto <matz@...> 2009/11/28

まつもと ゆきひろです

[#39806] Re: バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — keiju@... (石塚圭樹) 2009/11/28

けいじゅ@いしつかです.

[#39807] Re: バグ? ブロック引数で to_ary が呼ばれる必要のない場面で呼ばれる — Yukihiro Matsumoto <matz@...> 2009/11/28

まつもと ゆきひろです

[ruby-dev:39708] Re: [Feature #2372](Closed) read_all() with buffering

From: Tanaka Akira <akr@...>
Date: 2009-11-17 22:16:32 UTC
List: ruby-dev #39708
In article <8964790c0911152109l5400b295v201958dd8625971a@mail.gmail.com>,
  wanabe <s.wanabe@gmail.com> writes:

> すみません、ご指摘ありがとうございます。
> 見落としていました。取り急ぎ、rb_protect でくくるようにして再度コミットしました。

思うんですが、ワナベさんがやりたかったのはむしろ
ECONV_AFTER_OUTPUT を外したかったということなんじゃないです
かねぇ。

こうするとこちらでは速くなる感じですが、そちらではどうでしょ
う。

% svn diff --diff-cmd diff -x '-u -p'
Index: io.c
===================================================================
--- io.c	(revision 25821)
+++ io.c	(working copy)
@@ -1582,17 +1582,22 @@ make_readconv(rb_io_t *fptr, int size)
     }
 }
 
-static int
-more_char(rb_io_t *fptr)
+#define MORE_CHAR_CBUF_FULL Qtrue
+#define MORE_CHAR_FINISHED Qnil
+static VALUE
+fill_cbuf(rb_io_t *fptr, int ec_flags)
 {
     const unsigned char *ss, *sp, *se;
     unsigned char *ds, *dp, *de;
     rb_econv_result_t res;
     int putbackable;
     int cbuf_len0;
+    VALUE exc;
+
+    ec_flags |= ECONV_PARTIAL_INPUT;
 
     if (fptr->cbuf_len == fptr->cbuf_capa)
-        return 0; /* cbuf full */
+        return MORE_CHAR_CBUF_FULL; /* cbuf full */
     if (fptr->cbuf_len == 0)
         fptr->cbuf_off = 0;
     else if (fptr->cbuf_off + fptr->cbuf_len == fptr->cbuf_capa) {
@@ -1607,7 +1612,7 @@ more_char(rb_io_t *fptr)
         se = sp + fptr->rbuf_len;
         ds = dp = (unsigned char *)fptr->cbuf + fptr->cbuf_off + fptr->cbuf_len;
         de = (unsigned char *)fptr->cbuf + fptr->cbuf_capa;
-        res = rb_econv_convert(fptr->readconv, &sp, se, &dp, de, ECONV_PARTIAL_INPUT|ECONV_AFTER_OUTPUT);
+        res = rb_econv_convert(fptr->readconv, &sp, se, &dp, de, ec_flags);
         fptr->rbuf_off += (int)(sp - ss);
         fptr->rbuf_len -= (int)(sp - ss);
         fptr->cbuf_len += (int)(dp - ds);
@@ -1619,13 +1624,15 @@ more_char(rb_io_t *fptr)
             fptr->rbuf_len += putbackable;
         }
 
-        rb_econv_check_error(fptr->readconv);
+        exc = rb_econv_make_exception(fptr->readconv);
+        if (!NIL_P(exc))
+            return exc;
 
         if (cbuf_len0 != fptr->cbuf_len)
-            return 0;
+            return MORE_CHAR_CBUF_FULL;
 
         if (res == econv_finished) {
-            return -1;
+            return MORE_CHAR_FINISHED;
 	}
 
         if (res == econv_source_buffer_empty) {
@@ -1645,6 +1652,16 @@ more_char(rb_io_t *fptr)
 }
 
 static VALUE
+more_char(rb_io_t *fptr)
+{
+    VALUE v;
+    v = fill_cbuf(fptr, ECONV_AFTER_OUTPUT);
+    if (v != MORE_CHAR_CBUF_FULL && v != MORE_CHAR_FINISHED)
+        rb_exc_raise(v);
+    return v;
+}
+
+static VALUE
 io_shift_cbuf(rb_io_t *fptr, int len, VALUE *strp)
 {
     VALUE str;
@@ -1665,7 +1682,7 @@ io_shift_cbuf(rb_io_t *fptr, int len, VA
     /* xxx: set coderange */
     if (fptr->cbuf_len == 0)
         fptr->cbuf_off = 0;
-    if (fptr->cbuf_off < fptr->cbuf_capa/2) {
+    else if (fptr->cbuf_capa/2 < fptr->cbuf_off) {
         memmove(fptr->cbuf, fptr->cbuf+fptr->cbuf_off, fptr->cbuf_len);
         fptr->cbuf_off = 0;
     }
@@ -1686,21 +1703,19 @@ read_all(rb_io_t *fptr, long siz, VALUE 
         else rb_str_set_len(str, 0);
         make_readconv(fptr, 0);
         while (1) {
-	    int fin, state = 0;
-
-            if (fptr->cbuf_len > fptr->cbuf_capa / 2) {
+            VALUE v;
+            if (fptr->cbuf_len) {
                 io_shift_cbuf(fptr, fptr->cbuf_len, &str);
             }
-
-	    fin = rb_protect((VALUE (*)(VALUE))more_char, (VALUE)fptr, &state);
-	    if (fin == -1 || state != 0) {
-		if (fptr->cbuf_len) {
-		    io_shift_cbuf(fptr, fptr->cbuf_len, &str);
-		}
-		if (state != 0) {
-		    rb_jump_tag(state);
-		}
-		clear_readconv(fptr);
+            v = fill_cbuf(fptr, 0);
+            if (v != MORE_CHAR_CBUF_FULL && v != MORE_CHAR_FINISHED) {
+                if (fptr->cbuf_len) {
+                    io_shift_cbuf(fptr, fptr->cbuf_len, &str);
+                }
+                rb_exc_raise(v);
+            }
+            if (v == MORE_CHAR_FINISHED) {
+                clear_readconv(fptr);
                 return io_enc_str(str, fptr);
             }
         }
@@ -2181,7 +2196,7 @@ appendline(rb_io_t *fptr, int delim, VAL
                     return (unsigned char)RSTRING_PTR(str)[RSTRING_LEN(str)-1];
                 }
             }
-        } while (more_char(fptr) != -1);
+        } while (more_char(fptr) != MORE_CHAR_FINISHED);
         clear_readconv(fptr);
         *lp = limit;
         return EOF;
@@ -2695,7 +2710,8 @@ io_getc(rb_io_t *fptr, rb_encoding *enc)
                 }
             }
 
-            if (more_char(fptr) == -1) {
+            if (more_char(fptr) == MORE_CHAR_FINISHED) {
+                clear_readconv(fptr);
                 if (fptr->cbuf_len == 0)
                     return Qnil;
                 /* return an incomplete character just before EOF */
@@ -2830,8 +2846,8 @@ rb_io_each_codepoint(VALUE io)
 			rb_raise(rb_eIOError, "too long character");
 		    }
 		}
-		if (more_char(fptr) == -1) {
-		    clear_readconv(fptr);
+		if (more_char(fptr) == MORE_CHAR_FINISHED) {
+                    clear_readconv(fptr);
 		    /* ignore an incomplete character before EOF */
 		    return io;
 		}

-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread