summaryrefslogtreecommitdiffstats
path: root/cmd-set-hook.c
diff options
context:
space:
mode:
authornicm <nicm>2015-12-11 15:46:57 +0000
committernicm <nicm>2015-12-11 15:46:57 +0000
commitbd5918760ecd1f40a574ccc8a302af869f68c27f (patch)
tree61937b9355903e6810816eaf4068567df478f36e /cmd-set-hook.c
parentd7e11d0af78bacc7722998509ac93be7fcffc7b4 (diff)
We cannot do hooks_find and then hooks_remove because it might have come
from the parent (global) tree, instead make it remove by name like options. While here, also tidy up a few bits of options and hooks handling (use RB_FOREACH_SAFE, and a helper function for the free).
Diffstat (limited to 'cmd-set-hook.c')
-rw-r--r--cmd-set-hook.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cmd-set-hook.c b/cmd-set-hook.c
index f35e7a0a..ec58418e 100644
--- a/cmd-set-hook.c
+++ b/cmd-set-hook.c
@@ -93,8 +93,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq)
name);
return (CMD_RETURN_ERROR);
}
- if ((hook = hooks_find(hooks, name)) != NULL)
- hooks_remove(hooks, hook);
+ hooks_remove(hooks, name);
return (CMD_RETURN_NORMAL);
}