summaryrefslogtreecommitdiff
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
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
-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 3e45c34bb90..796f094e0b9 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 02535f3949a..9a471ff8529 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;