[#38392] Enumerable#gather_each — Tanaka Akira <akr@...>

ときに、複数行をまとめて扱いたいことがあります。

47 messages 2009/05/09
[#38399] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/09

At Sat, 9 May 2009 15:30:20 +0900,

[#38405] Re: Enumerable#gather_each — Tanaka Akira <akr@...> 2009/05/10

In article <86r5yy2nrg.knu@iDaemons.org>,

[#38417] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/10

At Sun, 10 May 2009 10:08:47 +0900,

[#38394] Re: Enumerable#gather_each — ujihisa <ujihisa@...> 2009/05/09

ujihisaと申します。

[#38400] Re: Enumerable#gather_each — Yukihiro Matsumoto <matz@...> 2009/05/09

まつもと ゆきひろです

[#38524] [Bug #1503] -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる — sinnichi eguchi <redmine@...>

Bug #1503: -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる

8 messages 2009/05/22

[ruby-dev:38403] [Bug #1452] DL::CPtr.new doesn't check the type of the 3rd arg.

From: Takashi Tamura <redmine@...>
Date: 2009-05-10 00:36:38 UTC
List: ruby-dev #38403
Bug #1452: DL::CPtr.new doesn't check the type of the 3rd arg.
http://redmine.ruby-lang.org/issues/show/1452

起票者: Takashi Tamura
ステータス: Open, 優先度: Normal
カテゴリ: ext, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-05-02 trunk 23326) [i686-linux]

DL::CPtr.new が引数の型をチェックせずいきなり構造体へキャストしてます。
パッチです。

 $ svn diff cptr.c
 Index: cptr.c
 ===================================================================
 --- cptr.c      (リビジョン 23328)
 +++ cptr.c      (作業コピー)
 @@ -109,6 +109,7 @@ rb_dlptr_initialize(int argc, VALUE argv
  {
    VALUE ptr, sym, size;
    struct ptr_data *data;
 +  extern VALUE rb_cDLCFunc;
    void *p = NULL;
    freefunc_t f = NULL;
    long s = 0;
 @@ -124,7 +125,15 @@ rb_dlptr_initialize(int argc, VALUE argv
    case 3:
      p = (void*)(NUM2PTR(rb_Integer(ptr)));
      s = NUM2LONG(size);
 -    f = NIL_P(sym) ? NULL : RCFUNC_DATA(sym)->ptr;
 +    if (NIL_P(sym)) {
 +      f = NULL;
 +    }
 +    else if (rb_obj_is_kind_of(sym, rb_cDLCFunc) == Qtrue ){
 +      f = RCFUNC_DATA(sym)->ptr;
 +    }
 +    else {
 +      f = NUM2PTR(rb_Integer(sym));
 +    }
      break;
    default:
      rb_bug("rb_dlptr_initialize");


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next