1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-07-28 03:32:48 +00:00
parent 79d8d7439a
commit ad8ab9c013
2 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,6 @@
Thu Jul 28 12:32:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
Thu Jul 28 12:32:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.

View file

@ -597,7 +597,7 @@ rb_dlptr_size_get(VALUE self)
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 @@ rb_dlptr_s_to_ptr(VALUE self, VALUE val)
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;