Commit 127d1184 authored by Matthias Braun's avatar Matthias Braun
Browse files

assert that no hook_entry is registered twice

parent f6b78c1b
......@@ -1124,7 +1124,7 @@ static void dump_node_vcgattr(FILE *F, ir_node *node, ir_node *local, int bad)
void *dump_add_node_info_callback(dump_node_info_cb_t *cb, void *data)
{
hook_entry_t *info = XMALLOC(hook_entry_t);
hook_entry_t *info = XMALLOCZ(hook_entry_t);
info->hook._hook_node_info = cb;
info->context = data;
......
......@@ -25,6 +25,8 @@
*/
#include "config.h"
#include <assert.h>
#include "irhooks.h"
/* the hooks */
......@@ -37,6 +39,9 @@ void register_hook(hook_type_t hook, hook_entry_t *entry)
if (! entry->hook._hook_turn_into_id)
return;
/* hook should not be registered yet */
assert(entry->next == NULL && hooks[hook] != entry);
entry->next = hooks[hook];
hooks[hook] = entry;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment