From 2788afc3dd5d825246f13189b14353b0f069e7e3 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 28 Feb 2016 02:40:15 +0100 Subject: [PATCH] Replaced memset with braced initializers in the HPMHooking hook handlers Signed-off-by: Haru --- tools/HPMHookGen/HPMHookGen.pl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index 4dedb48c287..201a82bf86d 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -208,7 +208,6 @@ ($$) $lastvar = $var; } - my $rtmemset = 0; my $rtinit = ''; foreach ($rt) { # Decide initialization for the return value my $x = $_; @@ -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)$/ @@ -267,7 +265,6 @@ ($$) vname => $variadic ? "v$name" : $name, type => $rt, typeinit => $rtinit, - memset => $rtmemset, variadic => $variadic, args => \@args, notes => $notes, @@ -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} });