Skip to content

Commit 64be56e

Browse files
minadsjaeckel
authored andcommitted
remove global $deplist
1 parent dfcaf41 commit 64be56e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

helper.pl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,14 @@ sub process_makefiles {
275275
}
276276
}
277277

278-
my $deplist;
279-
280278
sub draw_func
281279
{
282-
my ($depmap, $out, $indent, $funcslist) = @_;
280+
my ($deplist, $depmap, $out, $indent, $funcslist) = @_;
283281
my @funcs = split ',', $funcslist;
284282
# try this if you want to have a look at a minimized version of the callgraph without all the trivial functions
285283
#if ($deplist =~ /$funcs[0]/ || $funcs[0] =~ /BN_MP_(ADD|SUB|CLEAR|CLEAR_\S+|DIV|MUL|COPY|ZERO|GROW|CLAMP|INIT|INIT_\S+|SET|ABS|CMP|CMP_D|EXCH)_C/) {
286284
if ($deplist =~ /$funcs[0]/) {
287-
return;
285+
return $deplist;
288286
} else {
289287
$deplist = $deplist . $funcs[0];
290288
}
@@ -294,12 +292,11 @@ sub draw_func
294292
}
295293
print {$out} $funcs[0] . "\n";
296294
shift @funcs;
297-
my $temp = $deplist;
295+
my $olddeplist = $deplist;
298296
foreach my $i (@funcs) {
299-
draw_func($depmap, $out, $indent + 1, ${$depmap}{$i}) if exists ${$depmap}{$i};
297+
$deplist = draw_func($deplist, $depmap, $out, $indent + 1, ${$depmap}{$i}) if exists ${$depmap}{$i};
300298
}
301-
$deplist = $temp;
302-
return;
299+
return $olddeplist;
303300
}
304301

305302
sub update_dep
@@ -431,8 +428,7 @@ sub update_dep
431428

432429
open(my $out, '>', 'callgraph.txt');
433430
foreach (sort keys %depmap) {
434-
$deplist = '';
435-
draw_func(\%depmap, $out, 0, $depmap{$_});
431+
draw_func("", \%depmap, $out, 0, $depmap{$_});
436432
print {$out} "\n\n";
437433
}
438434
close $out;

0 commit comments

Comments
 (0)