summaryrefslogtreecommitdiff
path: root/ext/fiddle/lib/fiddle/import.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-17 09:51:23 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-17 09:51:23 +0000
commit1aaeeb326e754c5c5db83fbf35f780f729a9dfed (patch)
tree965d2c17a5c7d113e86d148c62404744f82dec3b /ext/fiddle/lib/fiddle/import.rb
parent131dc83145fb72da00af94490e630b0339513fb2 (diff)
long long is a C99ism
so SIZEOF_LONG_LONG is not always available. We have to check its defined?-ness before using. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/fiddle/lib/fiddle/import.rb')
-rw-r--r--ext/fiddle/lib/fiddle/import.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb
index 59ab3ee6f76..ae44914ec36 100644
--- a/ext/fiddle/lib/fiddle/import.rb
+++ b/ext/fiddle/lib/fiddle/import.rb
@@ -115,8 +115,6 @@ module Fiddle
return SIZEOF_INT
when TYPE_LONG
return SIZEOF_LONG
- when TYPE_LONG_LONG
- return SIZEOF_LONG_LONG
when TYPE_FLOAT
return SIZEOF_FLOAT
when TYPE_DOUBLE
@@ -124,7 +122,12 @@ module Fiddle
when TYPE_VOIDP
return SIZEOF_VOIDP
else
- raise(DLError, "unknown type: #{ty}")
+ if defined?(TYPE_LONG_LONG) and
+ ty == TYPE_LONG_LONG
+ return SIZEOF_LONG_LONG
+ else
+ raise(DLError, "unknown type: #{ty}")
+ end
end
when Class
if( ty.instance_methods().include?(:to_ptr) )