entry->fn = fn;
entry->priority = priority;
- RB_DLINK_FOREACH(ptr, &hooks[i].hooks.head)
+ RB_DLINK_FOREACH(ptr, hooks[i].hooks.head)
{
struct hook_entry *o = ptr->data;
- if (entry->priority < o->priority)
+ if (entry->priority <= o->priority)
{
rb_dlinkAddBefore(ptr, entry, &entry->node, &hooks[i].hooks);
return;
if((i = find_hook(name)) < 0)
return;
- RB_DLINK_FOREACH_SAFE(ptr, scratch, &hooks[i].hooks.head)
+ RB_DLINK_FOREACH_SAFE(ptr, scratch, hooks[i].hooks.head)
{
struct hook_entry *entry = ptr->data;
if (entry->fn == fn)