summaryrefslogtreecommitdiff
path: root/src/plugins/HPMHooking.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-11-16 06:35:51 +0100
committerHaru <haru@dotalux.com>2014-11-16 07:16:23 +0100
commit02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f (patch)
tree3161fd5786bb563c32059068eb3b4876d2ae11ca /src/plugins/HPMHooking.c
parent31bff051ee3c353fb7ee5e544d68feeaefd4941f (diff)
downloadhercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.gz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.bz2
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.xz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.zip
Whitespace cleanup (no code changes)
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/plugins/HPMHooking.c')
-rw-r--r--src/plugins/HPMHooking.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c
index e6f52790d..d1b267cf1 100644
--- a/src/plugins/HPMHooking.c
+++ b/src/plugins/HPMHooking.c
@@ -145,11 +145,11 @@ HPExport bool Hooked (bool *fr) {
HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) {
struct HookingPointData *hpd;
-
+
if( hp_db && (hpd = strdb_get(hp_db,target)) ) {
struct HPMHookPoint **hp = NULL;
int *count = NULL;
-
+
if( type == HOOK_TYPE_PRE ) {
hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*hpd->idx));
count = (int *)((char *)&HPMHooks.count + (sizeof(int)*hpd->idx));
@@ -157,21 +157,21 @@ HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target,
hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*(hpd->idx+1)));
count = (int *)((char *)&HPMHooks.count + (sizeof(int)*(hpd->idx+1)));
}
-
+
if( hp ) {
*count += 1;
-
+
RECREATE(*hp, struct HPMHookPoint, *count);
-
+
(*hp)[*count - 1].func = hook;
(*hp)[*count - 1].pID = pID;
-
+
*(hpd->sref) = hpd->tref;
-
+
return true;
}
}
-
+
return false;
}
@@ -179,46 +179,45 @@ HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target,
void HPM_HP_final(void) {
int i, len = HPMHooks.data.total * 2;
-
+
if( hp_db )
db_destroy(hp_db);
-
+
for(i = 0; i < len; i++) {
int *count = (int *)((char *)&HPMHooks.count + (sizeof(int)*(i)));
-
+
if( count && *count ) {
struct HPMHookPoint **hp = (struct HPMHookPoint **)((char *)&HPMHooks.list + (sizeof(struct HPMHookPoint *)*(i)));
-
+
if( hp && *hp )
aFree(*hp);
}
}
-
}
void HPM_HP_load(void) {
#include HPM_POINTS_INCLUDE
int i, len = ARRAYLENGTH(HookingPoints), idx = 0;
-
+
memset(&HPMHooks,0,sizeof(struct HPMHooksCore));
-
+
hp_db = strdb_alloc(DB_OPT_BASE|DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, HookingPointsLenMax);
-
+
for(i = 0; i < len; i++) {
struct HookingPointData *hpd = NULL;
-
+
CREATE(hpd, struct HookingPointData, 1);
-
+
memcpy(hpd, &HookingPoints[i], sizeof(struct HookingPointData));
-
+
hpd->idx = idx;
idx += 2;
-
+
strdb_put(hp_db, HookingPoints[i].name, hpd);
-
+
HPMHooks.data.total++;
}
-
+
#include HPM_SOURCES_INCLUDE
}