diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-04 23:21:01 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-04 23:21:01 +0000 |
commit | 570832b0be10a25b511da16c1a77f24d8f58da3c (patch) | |
tree | a271420e54e3851bbad5fb83b77a2ee1fa410161 | |
parent | 4e0ccdb387f5a76dabd5d311ffc1951ff87b3f83 (diff) | |
download | ruby-570832b0be10a25b511da16c1a77f24d8f58da3c.tar.gz ruby-570832b0be10a25b511da16c1a77f24d8f58da3c.tar.xz ruby-570832b0be10a25b511da16c1a77f24d8f58da3c.zip |
* ext/dl/cptr.c (to_int): DL::CPtr supports to_int
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/dl/cptr.c | 1 | ||||
-rw-r--r-- | test/dl/test_cptr.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c index b1b156a2b..11ecf6f81 100644 --- a/ext/dl/cptr.c +++ b/ext/dl/cptr.c @@ -626,6 +626,7 @@ Init_dlptr(void) rb_define_method(rb_cDLCPtr, "free=", rb_dlptr_free_set, 1); rb_define_method(rb_cDLCPtr, "free", rb_dlptr_free_get, 0); rb_define_method(rb_cDLCPtr, "to_i", rb_dlptr_to_i, 0); + rb_define_method(rb_cDLCPtr, "to_int", rb_dlptr_to_i, 0); rb_define_method(rb_cDLCPtr, "to_value", rb_dlptr_to_value, 0); rb_define_method(rb_cDLCPtr, "ptr", rb_dlptr_ptr, 0); rb_define_method(rb_cDLCPtr, "+@", rb_dlptr_ptr, 0); diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb index 64b78d134..953af286e 100644 --- a/test/dl/test_cptr.rb +++ b/test/dl/test_cptr.rb @@ -3,6 +3,11 @@ require_relative '../ruby/envutil' module DL class TestCPtr < TestBase + def test_cptr_to_int + null = DL::NULL + assert_equal(null.to_i, null.to_int) + end + def test_malloc_free_func_int free = CFunc.new(DL::RUBY_FREE, TYPE_VOID, 'free') |