projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
iropt: Or/Eor/Add are sometimes equivalent
[libfirm]
/
ir
/
ir
/
irhooks.c
diff --git
a/ir/ir/irhooks.c
b/ir/ir/irhooks.c
index
e5b6bcf
..
478f2e2
100644
(file)
--- a/
ir/ir/irhooks.c
+++ b/
ir/ir/irhooks.c
@@
-25,6
+25,8
@@
*/
#include "config.h"
*/
#include "config.h"
+#include <assert.h>
+
#include "irhooks.h"
/* the hooks */
#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;
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;
}
entry->next = hooks[hook];
hooks[hook] = entry;
}
@@
-52,7
+57,8
@@
void unregister_hook(hook_type_t hook, hook_entry_t *entry)
return;
}
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;
if (p) {
p->next = entry->next;