summaryrefslogtreecommitdiff
path: root/tools/HPMHookGen/HPMHookGen.pl
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-15 19:37:54 +0200
committerHaru <haru@dotalux.com>2016-04-30 15:57:48 +0200
commit8aacecc4bf47b40df0f78ef1ef58b2896bbbf299 (patch)
treeaf3e7149c57879564d26f1cd26c2d0a0d4c2385f /tools/HPMHookGen/HPMHookGen.pl
parentfa2f2f4f2cba8cfb2d6d950c69d7c4348ba66205 (diff)
downloadhercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.gz
hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.bz2
hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.tar.xz
hercules-8aacecc4bf47b40df0f78ef1ef58b2896bbbf299.zip
Removed extra indirection level in HPMHooking post-hooks
- The extra indirection level (necessary to override function arguments from a hook) isn't necessary in post-hooks, but only in pre-hooks. - This simplifies the syntax and code of post-hooks. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'tools/HPMHookGen/HPMHookGen.pl')
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl30
1 files changed, 16 insertions, 14 deletions
diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl
index 201a82bf8..c357d0dbd 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -194,16 +194,18 @@ sub parse($$) {
$indirectionlvl++ if ($array); # Arrays are pointer, no matter how cute you write them
push(@args, {
- var => $var,
- callvar => $callvar,
- type => $type1.$array.$type2,
- orig => $type1 eq '...' ? '...' : trim("$type1 $indir$var$array $type2"),
- indir => $indirectionlvl,
- hookf => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $dereference$indir$var$array $type2"),
- hookc => trim("$addressof$callvar"),
- origc => trim($callvar),
- pre => $pre_code,
- post => $post_code,
+ var => $var,
+ callvar => $callvar,
+ type => $type1.$array.$type2,
+ orig => $type1 eq '...' ? '...' : trim("$type1 $indir$var$array $type2"),
+ indir => $indirectionlvl,
+ hookpref => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $dereference$indir$var$array $type2"),
+ hookpostf => $type1 eq '...' ? "va_list ${var}" : trim("$type1 $indir$var$array $type2"),
+ hookprec => trim("$addressof$callvar"),
+ hookpostc => trim("$callvar"),
+ origc => trim($callvar),
+ pre => $pre_code,
+ post => $post_code,
});
$lastvar = $var;
}
@@ -416,10 +418,10 @@ foreach my $file (@files) { # Loop through the xml files
$if->{postcall} .= ', ';
}
$if->{handlerdef} .= $arg->{orig};
- $if->{predef} .= $arg->{hookf};
- $if->{precall} .= $arg->{hookc};
- $if->{postdef} .= $arg->{hookf};
- $if->{postcall} .= $arg->{hookc};
+ $if->{predef} .= $arg->{hookpref};
+ $if->{precall} .= $arg->{hookprec};
+ $if->{postdef} .= $arg->{hookpostf};
+ $if->{postcall} .= $arg->{hookpostc};
$if->{origcall} .= $arg->{origc};
$i++; $j++;
}