summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/dl/cptr.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e45c34bb9..796f094e0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
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;