ruby-changes:20671
From: nobu <ko1@a...>
Date: Thu, 28 Jul 2011 12:33:54 +0900 (JST)
Subject: [ruby-changes:20671] nobu:r32719 (trunk): * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall.
nobu 2011-07-28 12:32:48 +0900 (Thu, 28 Jul 2011) New Revision: 32719 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32719 Log: * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall. Modified files: trunk/ChangeLog trunk/ext/dl/cptr.c Index: ChangeLog =================================================================== --- ChangeLog (revision 32718) +++ ChangeLog (revision 32719) @@ -1,5 +1,7 @@ -Thu Jul 28 12:32:42 2011 Nobuyoshi Nakada <nobu@r...> +Thu Jul 28 12:32:46 2011 Nobuyoshi Nakada <nobu@r...> + * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall. + * ext/dl/cptr.c (rb_dlptr_s_to_ptr): fix wrapping condition. * ext/dl/cptr.c (rb_dlptr_s_to_ptr): fix wrapping condition. Index: ext/dl/cptr.c =================================================================== --- ext/dl/cptr.c (revision 32718) +++ ext/dl/cptr.c (revision 32719) @@ -597,7 +597,7 @@ static VALUE rb_dlptr_s_to_ptr(VALUE self, VALUE val) { - VALUE ptr, wrap = val; + VALUE ptr, wrap = val, vptr; if (RTEST(rb_obj_is_kind_of(val, rb_cIO))){ rb_io_t *fptr; @@ -610,8 +610,7 @@ char *str = StringValuePtr(val); ptr = rb_dlptr_new(str, RSTRING_LEN(val), NULL); } - else if (rb_respond_to(val, id_to_ptr)){ - VALUE vptr = rb_funcall(val, id_to_ptr, 0); + else if ((vptr = rb_check_funcall(val, id_to_ptr, 0, 0)) != Qundef){ if (rb_obj_is_kind_of(vptr, rb_cDLCPtr)){ ptr = vptr; wrap = 0; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/