native MergeUnits takes integer qty, integer a, integer b, integer make returns boolean
globals
integer test1 = 0
integer test2 = 0
unit test3 = 0
item test4 = 0
code l__Code
integer l__Int
endglobals
function UnusedFunction takes nothing returns nothing
call Print("Hello world")
endfunction
function TestLeakArg takes unit u returns nothing
set u = CreateUnit(...)
call SetUnitSomething(u,...)
endfunction
function TestNoLeakArg takes unit u returns nothing
set u = CreateUnit(...)
call SetUnitSomething(u,...)
set u = null
endfunction
function TestLeakVar takes nothing returns nothing
local unit u = CreateUnit(...)
call SetUnitSomething(u,...)
endfunction
function TestNoLeakVar takes unit u returns nothing
local unit u = CreateUnit(...)
call SetUnitSomething(u,...)
if SomeFunc( ) == true then
set u = null
return
endif
if SomeFunc2( ) == true then
return
endif
set u = null
return
endfunction
function UseGlobals takes nothing returns nothing
call TestFunction(test3)
set test4 = ...
endfunction
function TestTypeCast takes nothing returns nothing
local integer l__Code
local code l__Int
endfunction
function TestUnusedLocal takes nothing returns nothing
local unit u1 = null
local unit u2 = u1
local unit u3 = null
local unit u4 = u1
local unit u5 = null
call TestFunction(...)
call TestFunction(u2)
set u2 = u3//
endfunction
function main takes nothing returns nothing
call TestLeakArg( ... )
call TestNoLeakArg( ... )
call TestLeakVar( ... )
call TestNoLeakVar( ... )
call TestUnusedLocal( ... )
endfunction
function config takes nothing returns nothing
call UseGlobals( ... )
endfunction
native MergeUnits takes integer qty, integer a, integer b, integer make returns boolean
globals
unit test3 = 0
item test4 = 0
code l__Code
integer l__Int
endglobals
function TestLeakArg takes unit u returns nothing
set u = CreateUnit(...)
call SetUnitSomething(u,...)
set u = null
endfunction
function TestNoLeakArg takes unit u returns nothing
set u = CreateUnit(...)
call SetUnitSomething(u,...)
set u = null
endfunction
function TestLeakVar takes nothing returns nothing
local unit u = CreateUnit(...)
call SetUnitSomething(u,...)
set u = null
endfunction
function TestNoLeakVar takes unit u returns nothing
local unit u = CreateUnit(...)
call SetUnitSomething(u,...)
if SomeFunc( ) == true then
set u = null
return
endif
if SomeFunc2( ) == true then
set u = null
return
endif
set u = null
return
endfunction
function UseGlobals takes nothing returns nothing
call TestFunction(test3)
set test4 = ...
endfunction
//Found typecast function. Local variable have same name as global variable!
function TestTypeCast takes nothing returns nothing
local integer l__Code
local code l__Int
endfunction
//
function TestUnusedLocal takes nothing returns nothing
local unit u1 = null
local unit u2 = u1
local unit u3 = null
call TestFunction(...)
call TestFunction(u2)
set u2 = u3
set u2 = null
endfunction
function main takes nothing returns nothing
call TestLeakArg( ... )
call TestNoLeakArg( ... )
call TestLeakVar( ... )
call TestNoLeakVar( ... )
call TestUnusedLocal( ... )
endfunction
function config takes nothing returns nothing
call UseGlobals( ... )
endfunction