summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-14 06:10:14 +0200
committerLennart Poettering <lennart@poettering.net>2013-10-14 06:11:19 +0200
commit71fda00f320379f5cbee8e118848de98caaa229d (patch)
tree00a913086d70abadb1185e1343d97df860b0d612 /src/libsystemd-bus
parent14bf2c9d375db6a4670bc0ef0e521e35a939a498 (diff)
list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-objects.c16
-rw-r--r--src/libsystemd-bus/sd-bus.c14
2 files changed, 15 insertions, 15 deletions
diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c
index 1d32566c3a..cd56d13d6b 100644
--- a/src/libsystemd-bus/bus-objects.c
+++ b/src/libsystemd-bus/bus-objects.c
@@ -1196,7 +1196,7 @@ static struct node *bus_node_allocate(sd_bus *bus, const char *path) {
}
if (parent)
- LIST_PREPEND(struct node, siblings, parent->child, n);
+ LIST_PREPEND(siblings, parent->child, n);
return n;
}
@@ -1217,7 +1217,7 @@ static void bus_node_gc(sd_bus *b, struct node *n) {
assert(hashmap_remove(b->nodes, n->path) == n);
if (n->parent)
- LIST_REMOVE(struct node, siblings, n->parent->child, n);
+ LIST_REMOVE(siblings, n->parent->child, n);
free(n->path);
bus_node_gc(b, n->parent);
@@ -1255,7 +1255,7 @@ static int bus_add_object(
c->userdata = userdata;
c->is_fallback = fallback;
- LIST_PREPEND(struct node_callback, callbacks, n->callbacks, c);
+ LIST_PREPEND(callbacks, n->callbacks, c);
return 0;
fail:
@@ -1289,7 +1289,7 @@ static int bus_remove_object(
if (!c)
return 0;
- LIST_REMOVE(struct node_callback, callbacks, n->callbacks, c);
+ LIST_REMOVE(callbacks, n->callbacks, c);
free(c);
bus_node_gc(bus, n);
@@ -1546,7 +1546,7 @@ static int add_object_vtable_internal(
}
}
- LIST_PREPEND(struct node_vtable, vtables, n->vtables, c);
+ LIST_PREPEND(vtables, n->vtables, c);
return 0;
fail:
@@ -1582,7 +1582,7 @@ static int remove_object_vtable_internal(
if (!c)
return 0;
- LIST_REMOVE(struct node_vtable, vtables, n->vtables, c);
+ LIST_REMOVE(vtables, n->vtables, c);
free_node_vtable(bus, c);
bus_node_gc(bus, n);
@@ -1656,7 +1656,7 @@ int sd_bus_add_node_enumerator(
c->callback = callback;
c->userdata = userdata;
- LIST_PREPEND(struct node_enumerator, enumerators, n->enumerators, c);
+ LIST_PREPEND(enumerators, n->enumerators, c);
return 0;
fail:
@@ -1690,7 +1690,7 @@ int sd_bus_remove_node_enumerator(
if (!c)
return 0;
- LIST_REMOVE(struct node_enumerator, enumerators, n->enumerators, c);
+ LIST_REMOVE(enumerators, n->enumerators, c);
free(c);
bus_node_gc(bus, n);
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index ca687c0a65..d9f9dfd7fc 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -74,23 +74,23 @@ static void bus_node_destroy(sd_bus *b, struct node *n) {
bus_node_destroy(b, n->child);
while ((c = n->callbacks)) {
- LIST_REMOVE(struct node_callback, callbacks, n->callbacks, c);
+ LIST_REMOVE(callbacks, n->callbacks, c);
free(c);
}
while ((v = n->vtables)) {
- LIST_REMOVE(struct node_vtable, vtables, n->vtables, v);
+ LIST_REMOVE(vtables, n->vtables, v);
free(v->interface);
free(v);
}
while ((e = n->enumerators)) {
- LIST_REMOVE(struct node_enumerator, enumerators, n->enumerators, e);
+ LIST_REMOVE(enumerators, n->enumerators, e);
free(e);
}
if (n->parent)
- LIST_REMOVE(struct node, siblings, n->parent->child, n);
+ LIST_REMOVE(siblings, n->parent->child, n);
assert_se(hashmap_remove(b->nodes, n->path) == n);
free(n->path);
@@ -133,7 +133,7 @@ static void bus_free(sd_bus *b) {
prioq_free(b->reply_callbacks_prioq);
while ((f = b->filter_callbacks)) {
- LIST_REMOVE(struct filter_callback, callbacks, b->filter_callbacks, f);
+ LIST_REMOVE(callbacks, b->filter_callbacks, f);
free(f);
}
@@ -2127,7 +2127,7 @@ int sd_bus_add_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *user
f->userdata = userdata;
bus->filter_callbacks_modified = true;
- LIST_PREPEND(struct filter_callback, callbacks, bus->filter_callbacks, f);
+ LIST_PREPEND(callbacks, bus->filter_callbacks, f);
return 0;
}
@@ -2144,7 +2144,7 @@ int sd_bus_remove_filter(sd_bus *bus, sd_bus_message_handler_t callback, void *u
LIST_FOREACH(callbacks, f, bus->filter_callbacks) {
if (f->callback == callback && f->userdata == userdata) {
bus->filter_callbacks_modified = true;
- LIST_REMOVE(struct filter_callback, callbacks, bus->filter_callbacks, f);
+ LIST_REMOVE(callbacks, bus->filter_callbacks, f);
free(f);
return 1;
}