From b1b7c389fbea8da2989a241f4f067f73f2bb8e7d Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 30 Nov 2012 19:10:14 +0000 Subject: [PATCH] suppress warnings: uninitialized variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/lib/dl/import.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)