diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 19:10:14 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 19:10:14 +0000 |
commit | b1b7c389fbea8da2989a241f4f067f73f2bb8e7d (patch) | |
tree | 4d6e043b00838cca47b6be3b7eb497a58abd0ec7 | |
parent | 9207474f04b9aa6e60f1d0799a4afbd908e9dac7 (diff) |
suppress warnings: uninitialized variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ext/dl/lib/dl/import.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb index a318430b73..9005153624 100644 --- a/ext/dl/lib/dl/import.rb +++ b/ext/dl/lib/dl/import.rb @@ -79,6 +79,7 @@ module DL end def sizeof(ty) + @type_alias ||= nil case ty when String ty = parse_ctype(ty, @type_alias).abs() @@ -128,6 +129,7 @@ module DL private :parse_bind_options def extern(signature, *opts) + @type_alias ||= nil symname, ctype, argtype = parse_signature(signature, @type_alias) opt = parse_bind_options(opts) f = import_function(symname, ctype, argtype, opt[:call_type]) @@ -150,6 +152,7 @@ module DL end def bind(signature, *opts, &blk) + @type_alias ||= nil name, ctype, argtype = parse_signature(signature, @type_alias) h = parse_bind_options(opts) case h[:callback_type] @@ -183,6 +186,7 @@ module DL # # MyStruct = struct ['int i', 'char c'] def struct(signature) + @type_alias ||= nil tys, mems = parse_struct_signature(signature, @type_alias) DL::CStructBuilder.create(CStruct, tys, mems) end @@ -191,6 +195,7 @@ module DL # # MyUnion = union ['int i', 'char c'] def union(signature) + @type_alias ||= nil tys, mems = parse_struct_signature(signature, @type_alias) DL::CStructBuilder.create(CUnion, tys, mems) end @@ -216,7 +221,8 @@ module DL end def handler - @handler or raise "call dlload before importing symbols and functions" + defined?(@handler) or raise "call dlload before importing symbols and functions" + @handler end def import_symbol(name) |