ruby-changes:26035
From: naruse <ko1@a...>
Date: Sat, 1 Dec 2012 04:10:34 +0900 (JST)
Subject: [ruby-changes:26035] naruse:r38092 (trunk): suppress warnings: uninitialized variables
naruse 2012-12-01 04:10:14 +0900 (Sat, 01 Dec 2012) New Revision: 38092 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38092 Log: suppress warnings: uninitialized variables Modified files: trunk/ext/dl/lib/dl/import.rb Index: ext/dl/lib/dl/import.rb =================================================================== --- ext/dl/lib/dl/import.rb (revision 38091) +++ ext/dl/lib/dl/import.rb (revision 38092) @@ -79,6 +79,7 @@ end def sizeof(ty) + @type_alias ||= nil case ty when String ty = parse_ctype(ty, @type_alias).abs() @@ -128,6 +129,7 @@ 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 @@ 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 @@ # # 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 @@ # # 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 @@ 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/