summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-16 20:04:40 -0300
committershennetsind <ind@henn.et>2013-10-16 20:04:40 -0300
commit3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a (patch)
treee09b007b2dec290cef90a49e1b671ce7d59a7ce2
parent4a1332099ff348f88f3d2c05512a92d3bc6f9c25 (diff)
downloadhercules-3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a.tar.gz
hercules-3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a.tar.bz2
hercules-3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a.tar.xz
hercules-3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a.zip
Modified HPM Hook Caching
Dropped hard-coded indexes, will make updates of the file in the future be smaller and much more clear in content. Made Possible Thanks to Haruna <3 Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/plugins/HPMHooking.c8
-rwxr-xr-xtools/HPMHookGen/HPMHookGen.pl2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c
index 8b4f06ae0..1ca5b5f3c 100644
--- a/src/plugins/HPMHooking.c
+++ b/src/plugins/HPMHooking.c
@@ -53,8 +53,7 @@ HPExport struct hplugin_info pinfo = {
HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};
-#define HP_POP(x) #x , (void**)(&x)
-#define HP_POP2(x) (void*)x
+#define HP_POP(x,y) #x , (void**)(&x) , (void*)y , 0
DBMap *hp_db;/* hooking points db -- for quick lookup */
struct HookingPointData {
@@ -150,7 +149,7 @@ void HPM_HP_final(void) {
void HPM_HP_load(void) {
#include "../plugins/HPMHooking/HPMHooking.HookingPoints.inc"
- int i, len = ARRAYLENGTH(HookingPoints);
+ int i, len = ARRAYLENGTH(HookingPoints), idx = 0;
memset(&HPMHooks,0,sizeof(struct HPMHooksCore));
@@ -163,6 +162,9 @@ void HPM_HP_load(void) {
memcpy(hpd, &HookingPoints[i], sizeof(struct HookingPointData));
+ hpd->idx = idx;
+ idx += 2;
+
strdb_put(hp_db, HookingPoints[i].name, hpd);
HPMHooks.data.total++;
diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl
index 5333f3f03..cf50a9e77 100755
--- a/tools/HPMHookGen/HPMHookGen.pl
+++ b/tools/HPMHookGen/HPMHookGen.pl
@@ -392,7 +392,7 @@ foreach my $key (@keys) {
foreach my $if (@{ $ifs{$key} }) {
print FH <<"EOF";
- { HP_POP($key\->$if->{name}), HP_POP2($if->{hname}), $idx },
+ { HP_POP($key\->$if->{name}, $if->{hname}) },
EOF
$idx += 2;