shl: hook: link elements in reverse order
When adding new elements, we should add them at the tail, not at the
front. And when removing elements, we should remove them from the tail,
too.
We also convert the whole stuff to the shl_dlist API so we do not have to
manage the linked-list ourself.
Note that this silently breaks the idea of having multiple listeners with
the same function+data in the hook. This is because removing the listener
may now change order of two identical entries, as we don't know which of
them to remove. That means, when adding two identical entries, you cannot
rely on them to retain their position in regard to each other.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>