Skip to content

Commit

Permalink
Replaced memset with braced initializers in the HPMHooking hook handlers
Browse files Browse the repository at this point in the history
Signed-off-by: Haru <haru@dotalux.com>
  • Loading branch information
MishimaHaruna committed Apr 30, 2016
1 parent 4e49441 commit 2788afc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions tools/HPMHookGen/HPMHookGen.pl
Expand Up @@ -208,7 +208,6 @@ ($$)
$lastvar = $var;
}

my $rtmemset = 0;
my $rtinit = '';
foreach ($rt) { # Decide initialization for the return value
my $x = $_;
Expand Down Expand Up @@ -244,8 +243,7 @@ ($$)
} elsif ($x eq 'DBComparator' or $x eq 'DBHasher' or $x eq 'DBReleaser') { # DB function pointers
$rtinit = ' = NULL';
} elsif ($x =~ /^(?:struct|union)\s+.*$/) { # Structs and unions
$rtinit = '';
$rtmemset = 1;
$rtinit = ' = { 0 }';
} elsif ($x =~ /^float|double$/) { # Floating point variables
$rtinit = ' = 0.';
} elsif ($x =~ /^(?:(?:un)?signed\s+)?(?:char|int|long|short)$/
Expand All @@ -267,7 +265,6 @@ ($$)
vname => $variadic ? "v$name" : $name,
type => $rt,
typeinit => $rtinit,
memset => $rtmemset,
variadic => $variadic,
args => \@args,
notes => $notes,
Expand Down Expand Up @@ -687,7 +684,6 @@ ($$)

unless ($if->{type} eq 'void') {
$initialization = "\n\t$if->{type} retVal___$if->{typeinit};";
$initialization .= "\n\tmemset(&retVal___, '\\0', sizeof($if->{type}));" if $if->{memset};
}

$beforeblock3 .= "\n\t\t\t$_" foreach (@{ $if->{before} });
Expand Down

0 comments on commit 2788afc

Please sign in to comment.