From bd5918760ecd1f40a574ccc8a302af869f68c27f Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 11 Dec 2015 15:46:57 +0000 Subject: 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). --- cmd-set-hook.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmd-set-hook.c') 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); } -- cgit