9 Commits

Author SHA1 Message Date
David Herrmann
23e9903f07 misc: add safe list iterator
New for-each implementation that keeps a safe pointer to the next element
so you can remove the current element from the list.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-05 17:14:28 +02:00
David Herrmann
b7773bc70b misc: add double-linked list implementation
This adds a generic double-linked list implementation so we don't have to
write all list-handling over and over again.

The list-type is similar to the kernel list where we use the same type for
heads and entries. This is a _very_ convenient list-type so we copy it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-22 15:43:00 +02:00
David Herrmann
7a7f977d43 misc: add type-safe "offsetof"
This uses the GCC extension "typeof" to implement a type-safe "offsetof"
similar to the implementation in the linux kernel.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-22 15:40:39 +02:00
David Herrmann
68633aee06 misc: fix header protection
There was a typo in the macros for header protection.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-22 15:39:57 +02:00
David Herrmann
3a480dc910 misc: add kmscon_hook_num() helper
This helper returns the number of registered callbacks for an hook.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-15 14:57:17 +02:00
David Herrmann
2707ba7336 misc: hash-table wrapper
We want to move away from glib eventually. Until then, we use a simple
wrapper around the hash-table functions so we need to change a single
place only.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-30 18:42:12 +02:00
David Herrmann
56f5eebf0e hook: delete by callback *and* data argument
When deleting a hook we should not search for the callback only. Otherwise
we might remove the wrong callback. Therefore, we now search for callback
and data argument. If multiple callbacks are registered with the same data
and cb, then we don't care which one is removed as this wouldn't make any
difference. They behave the same way, anyway.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-25 17:08:00 +02:00
David Herrmann
c04c807eca misc: add hook structure
The hook structure can be used to provide a central hook where other
subsystems can register callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 15:12:37 +01:00
David Herrmann
2c8622d468 Add ring buffer object
The new ring buffer object will be used to buffer a byte-stream between
two sockets.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 17:16:37 +01:00