Skip to content

Commit

Permalink
Stylistic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 24, 2004
1 parent fe4b3ae commit bf7ac62
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions doomsday/Src/dd_plugin.c
Expand Up @@ -56,16 +56,16 @@ hookreg_t hooks[NUM_HOOK_TYPES];
* This routine is called by plugin DLLs who want to register hooks.
* Returns true iff the hook was successfully registered.
*/
int Plug_AddHook(int hook_type, hookfunc_t hook)
int Plug_AddHook(int hookType, hookfunc_t hook)
{
int i, type = HOOKMASK(hook_type);
int i, type = HOOKMASK(hookType);

// The type must be good.
if(type < 0 || type >= NUM_HOOK_TYPES)
return false;

// Exclusive hooks.
if(hook_type & HOOKF_EXCLUSIVE)
if(hookType & HOOKF_EXCLUSIVE)
{
hooks[type].exclude = true;
memset(hooks[type].list, 0, sizeof(hooks[type].list));
Expand All @@ -89,9 +89,9 @@ int Plug_AddHook(int hook_type, hookfunc_t hook)
* Plug_RemoveHook
* Removes the given hook, and returns true iff it was found.
*/
int Plug_RemoveHook(int hook_type, hookfunc_t hook)
int Plug_RemoveHook(int hookType, hookfunc_t hook)
{
int i, type = HOOKMASK(hook_type);
int i, type = HOOKMASK(hookType);

// The type must be good.
if(type < 0 || type >= NUM_HOOK_TYPES)
Expand All @@ -100,7 +100,7 @@ int Plug_RemoveHook(int hook_type, hookfunc_t hook)
if(hooks[type].list[i] == hook)
{
hooks[type].list[i] = NULL;
if(hook_type & HOOKF_EXCLUSIVE)
if(hookType & HOOKF_EXCLUSIVE)
{
// Exclusive hook removed; allow normal hooks.
hooks[type].exclude = false;
Expand All @@ -116,37 +116,24 @@ int Plug_RemoveHook(int hook_type, hookfunc_t hook)
* is set if a hook was executed successfully (returned true). Bit one is
* set if all the hooks that were executed returned true.
*/
int Plug_DoHook(int hook_type)
int Plug_DoHook(int hookType, int parm, void *data)
{
int i, ret = 0;
boolean allgood = true;
int parm = 0;
void *data = NULL;

// Set the parm and data pointer according to the hook type.
switch (hook_type)
{
case HOOK_DEFS:
data = &defs;
break;

default:
break;
}
boolean allGood = true;

// Try all the hooks.
for(i = 0; i < MAX_HOOKS; i++)
if(hooks[hook_type].list[i])
if(hooks[hookType].list[i])
{
if(hooks[hook_type].list[i] (hook_type, parm, data))
if(hooks[hookType].list[i] (hookType, parm, data))
{
// One hook executed; return nonzero from this routine.
ret = 1;
}
else
allgood = false;
allGood = false;
}
if(ret && allgood)
if(ret && allGood)
ret |= 2;
return ret;
}

0 comments on commit bf7ac62

Please sign in to comment.