summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:48 +0000
commitad8ab9c0132fd5b90187b1ba2825d1fd9eaebe14 (patch)
treed45894efd497118c850950a51790facf99edd836 /ext
parent79d8d7439a84782f4c7155fcc8f9da4471a38823 (diff)
* 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
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/cptr.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c
index 02535f3949..9a471ff852 100644
--- a/ext/dl/cptr.c
+++ b/ext/dl/cptr.c
@@ -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;