X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fir%2Firhooks.c;h=478f2e2c9c6b29d05db426ec6aa271faea3c98d5;hb=b7bf9774e5e704382bdf3eb7c09bc5755d4f067e;hp=e5b6bcf9a2dabffdf5c3198443524238191d9157;hpb=1a3b7d363474ab544c13093a2f0b578718d37c7a;p=libfirm diff --git a/ir/ir/irhooks.c b/ir/ir/irhooks.c index e5b6bcf9a..478f2e2c9 100644 --- a/ir/ir/irhooks.c +++ b/ir/ir/irhooks.c @@ -25,6 +25,8 @@ */ #include "config.h" +#include + #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; } @@ -52,7 +57,8 @@ void unregister_hook(hook_type_t hook, hook_entry_t *entry) return; } - for (p = hooks[hook]; p && p->next != entry; p = p->next); + for (p = hooks[hook]; p && p->next != entry; p = p->next) { + } if (p) { p->next = entry->next;