summaryrefslogtreecommitdiff
path: root/src/hooks.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2014-12-18 19:22:12 +0100
committerBardur Arantsson <bardur@scientician.net>2014-12-23 12:07:54 +0100
commitdd5f6f4691b9975c7087a9bb6f92befd59e5d795 (patch)
tree7c271361e39fa556fbadf68f53f46e904e5d478a /src/hooks.cc
parentc315b41d8fd2ee37a36eaaafec10994623392df3 (diff)
Update HOOK_GIVE to new-style hook
Diffstat (limited to 'src/hooks.cc')
-rw-r--r--src/hooks.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/hooks.cc b/src/hooks.cc
index 0d89586a..e1dff3ce 100644
--- a/src/hooks.cc
+++ b/src/hooks.cc
@@ -100,6 +100,34 @@ void del_hook(int h_idx, hook_type hook)
}
}
+void del_hook_new(int h_idx, bool_ (*hook_f)(void *, void *, void *))
+{
+ hooks_chain *c = hooks_heads[h_idx], *p = NULL;
+
+ /* Find it */
+ while ((c != NULL) && (c->hook_f != hook_f))
+ {
+ p = c;
+ c = c->next;
+ }
+
+ /* Remove it */
+ if (c != NULL)
+ {
+ if (p == NULL)
+ {
+ hooks_heads[h_idx] = c->next;
+ delete c;
+ }
+ else
+ {
+ p->next = c->next;
+ delete c;
+ }
+ }
+};
+
+
/* get the next argument */
static hook_return param_pile[MAX_ARGS];
static int get_next_arg_pos = 0;