summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootchart/bootchart.c4
-rw-r--r--src/bootchart/svg.c2
-rw-r--r--src/core/cgroup.c10
-rw-r--r--src/core/dbus-cgroup.c8
-rw-r--r--src/core/dbus-job.c2
-rw-r--r--src/core/dbus-unit.c4
-rw-r--r--src/core/dbus.c2
-rw-r--r--src/core/device.c4
-rw-r--r--src/core/execute.c6
-rw-r--r--src/core/job.c20
-rw-r--r--src/core/load-fragment.c22
-rw-r--r--src/core/manager.c2
-rw-r--r--src/core/path.c2
-rw-r--r--src/core/socket.c2
-rw-r--r--src/core/swap.c4
-rw-r--r--src/core/timer.c2
-rw-r--r--src/core/transaction.c4
-rw-r--r--src/core/umount.c20
-rw-r--r--src/core/unit.c28
-rw-r--r--src/initctl/initctl.c4
-rw-r--r--src/journal/journald-rate-limit.c8
-rw-r--r--src/journal/journald-stream.c4
-rw-r--r--src/journal/mmap-cache.c16
-rw-r--r--src/journal/sd-journal.c4
-rw-r--r--src/libsystemd-bus/bus-objects.c16
-rw-r--r--src/libsystemd-bus/sd-bus.c14
-rw-r--r--src/login/logind-device.c6
-rw-r--r--src/login/logind-seat.c6
-rw-r--r--src/login/logind-session-device.c4
-rw-r--r--src/login/logind-session.c10
-rw-r--r--src/login/logind-user.c4
-rw-r--r--src/login/logind.c6
-rw-r--r--src/machine/machine.c4
-rw-r--r--src/machine/machined.c2
-rw-r--r--src/shared/list.h26
-rw-r--r--src/systemctl/systemctl.c4
-rw-r--r--src/test/test-list.c22
37 files changed, 153 insertions, 155 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index edbd3815cd..1f40c2edf4 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -332,7 +332,7 @@ int main(int argc, char *argv[]) {
log_uptime();
- LIST_HEAD_INIT(struct list_sample_data, head);
+ LIST_HEAD_INIT(head);
/* main program loop */
for (samples = 0; !exiting && samples < arg_samples_len; samples++) {
@@ -406,7 +406,7 @@ int main(int argc, char *argv[]) {
/* calculate how many samples we lost and scrap them */
arg_samples_len -= (int)(newint_ns / interval);
}
- LIST_PREPEND(struct list_sample_data, link, head, sampledata);
+ LIST_PREPEND(link, head, sampledata);
}
/* do some cleanup, close fd's */
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index 7ac0138a2b..c088cad7f5 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -81,7 +81,7 @@ static void svg_header(void) {
struct list_sample_data *sampledata_last;
sampledata = head;
- LIST_FIND_TAIL(struct list_sample_data, link, sampledata, head);
+ LIST_FIND_TAIL(link, sampledata, head);
sampledata_last = head;
LIST_FOREACH_BEFORE(link, sampledata, head) {
sampledata_last = sampledata;
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 8bf4d896de..f0a97e6818 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -41,7 +41,7 @@ void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a) {
assert(c);
assert(a);
- LIST_REMOVE(CGroupDeviceAllow, device_allow, c->device_allow, a);
+ LIST_REMOVE(device_allow, c->device_allow, a);
free(a->path);
free(a);
}
@@ -50,7 +50,7 @@ void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODe
assert(c);
assert(w);
- LIST_REMOVE(CGroupBlockIODeviceWeight, device_weights, c->blockio_device_weights, w);
+ LIST_REMOVE(device_weights, c->blockio_device_weights, w);
free(w->path);
free(w);
}
@@ -59,7 +59,7 @@ void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockI
assert(c);
assert(b);
- LIST_REMOVE(CGroupBlockIODeviceBandwidth, device_bandwidths, c->blockio_device_bandwidths, b);
+ LIST_REMOVE(device_bandwidths, c->blockio_device_bandwidths, b);
free(b->path);
free(b);
}
@@ -426,7 +426,7 @@ static int unit_realize_cgroup_now(Unit *u) {
assert(u);
if (u->in_cgroup_queue) {
- LIST_REMOVE(Unit, cgroup_queue, u->manager->cgroup_queue, u);
+ LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u);
u->in_cgroup_queue = false;
}
@@ -450,7 +450,7 @@ static void unit_add_to_cgroup_queue(Unit *u) {
if (u->in_cgroup_queue)
return;
- LIST_PREPEND(Unit, cgroup_queue, u->manager->cgroup_queue, u);
+ LIST_PREPEND(cgroup_queue, u->manager->cgroup_queue, u);
u->in_cgroup_queue = true;
}
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index 9ebcad9da6..5654b8c711 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -273,8 +273,7 @@ int bus_cgroup_set_property(
a->bandwidth = u64;
if (!exist)
- LIST_PREPEND(CGroupBlockIODeviceBandwidth, device_bandwidths,
- c->blockio_device_bandwidths, a);
+ LIST_PREPEND(device_bandwidths, c->blockio_device_bandwidths, a);
}
n++;
@@ -369,8 +368,7 @@ int bus_cgroup_set_property(
a->weight = ul;
if (!exist)
- LIST_PREPEND(CGroupBlockIODeviceWeight, device_weights,
- c->blockio_device_weights, a);
+ LIST_PREPEND(device_weights,c->blockio_device_weights, a);
}
n++;
@@ -517,7 +515,7 @@ int bus_cgroup_set_property(
a->m = !!strchr(rwm, 'm');
if (!exist)
- LIST_PREPEND(CGroupDeviceAllow, device_allow, c->device_allow, a);
+ LIST_PREPEND(device_allow, c->device_allow, a);
}
n++;
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 4ab88d06c3..eac2448915 100644
--- a/src/core/dbus-job.c
+++ b/src/core/dbus-job.c
@@ -319,7 +319,7 @@ void bus_job_send_change_signal(Job *j) {
assert(j);
if (j->in_dbus_queue) {
- LIST_REMOVE(Job, dbus_queue, j->manager->dbus_job_queue, j);
+ LIST_REMOVE(dbus_queue, j->manager->dbus_job_queue, j);
j->in_dbus_queue = false;
}
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 2ea59b2913..b6f5c39810 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -627,7 +627,7 @@ void bus_unit_send_change_signal(Unit *u) {
assert(u);
if (u->in_dbus_queue) {
- LIST_REMOVE(Unit, dbus_queue, u->manager->dbus_unit_queue, u);
+ LIST_REMOVE(dbus_queue, u->manager->dbus_unit_queue, u);
u->in_dbus_queue = false;
}
@@ -801,7 +801,7 @@ DBusHandlerResult bus_unit_queue_job(
if (!cl)
goto oom;
- LIST_PREPEND(JobBusClient, client, j->bus_client_list, cl);
+ LIST_PREPEND(client, j->bus_client_list, cl);
reply = dbus_message_new_method_return(message);
if (!reply)
diff --git a/src/core/dbus.c b/src/core/dbus.c
index aa3d93bf06..771ba01f67 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1170,7 +1170,7 @@ static void shutdown_connection(Manager *m, DBusConnection *c) {
JobBusClient *cl, *nextcl;
LIST_FOREACH_SAFE(client, cl, nextcl, j->bus_client_list) {
if (cl->bus == c) {
- LIST_REMOVE(JobBusClient, client, j->bus_client_list, cl);
+ LIST_REMOVE(client, j->bus_client_list, cl);
free(cl);
}
}
diff --git a/src/core/device.c b/src/core/device.c
index 25af2cb2d5..05950153d3 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -48,7 +48,7 @@ static void device_unset_sysfs(Device *d) {
/* Remove this unit from the chain of devices which share the
* same sysfs path. */
first = hashmap_get(UNIT(d)->manager->devices_by_sysfs, d->sysfs);
- LIST_REMOVE(Device, same_sysfs, first, d);
+ LIST_REMOVE(same_sysfs, first, d);
if (first)
hashmap_remove_and_replace(UNIT(d)->manager->devices_by_sysfs, d->sysfs, first->sysfs, first);
@@ -234,7 +234,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
}
first = hashmap_get(m->devices_by_sysfs, sysfs);
- LIST_PREPEND(Device, same_sysfs, first, DEVICE(u));
+ LIST_PREPEND(same_sysfs, first, DEVICE(u));
r = hashmap_replace(m->devices_by_sysfs, DEVICE(u)->sysfs, first);
if (r < 0)
diff --git a/src/core/execute.c b/src/core/execute.c
index 3f7ca52139..b48b1ae513 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1706,7 +1706,7 @@ void exec_command_free_list(ExecCommand *c) {
ExecCommand *i;
while ((i = c)) {
- LIST_REMOVE(ExecCommand, command, c, i);
+ LIST_REMOVE(command, c, i);
exec_command_done(i);
free(i);
}
@@ -2194,8 +2194,8 @@ void exec_command_append_list(ExecCommand **l, ExecCommand *e) {
if (*l) {
/* It's kind of important, that we keep the order here */
- LIST_FIND_TAIL(ExecCommand, command, *l, end);
- LIST_INSERT_AFTER(ExecCommand, command, *l, end, e);
+ LIST_FIND_TAIL(command, *l, end);
+ LIST_INSERT_AFTER(command, *l, end, e);
} else
*l = e;
}
diff --git a/src/core/job.c b/src/core/job.c
index bf1d956908..e5dcef7cf4 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -99,10 +99,10 @@ void job_free(Job *j) {
assert(!j->object_list);
if (j->in_run_queue)
- LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
+ LIST_REMOVE(run_queue, j->manager->run_queue, j);
if (j->in_dbus_queue)
- LIST_REMOVE(Job, dbus_queue, j->manager->dbus_job_queue, j);
+ LIST_REMOVE(dbus_queue, j->manager->dbus_job_queue, j);
if (j->timer_watch.type != WATCH_INVALID) {
assert(j->timer_watch.type == WATCH_JOB_TIMER);
@@ -114,7 +114,7 @@ void job_free(Job *j) {
}
while ((cl = j->bus_client_list)) {
- LIST_REMOVE(JobBusClient, client, j->bus_client_list, cl);
+ LIST_REMOVE(client, j->bus_client_list, cl);
free(cl);
}
free(j);
@@ -267,9 +267,9 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool
l->conflicts = conflicts;
if (subject)
- LIST_PREPEND(JobDependency, subject, subject->subject_list, l);
+ LIST_PREPEND(subject, subject->subject_list, l);
- LIST_PREPEND(JobDependency, object, object->object_list, l);
+ LIST_PREPEND(object, object->object_list, l);
return l;
}
@@ -278,9 +278,9 @@ void job_dependency_free(JobDependency *l) {
assert(l);
if (l->subject)
- LIST_REMOVE(JobDependency, subject, l->subject->subject_list, l);
+ LIST_REMOVE(subject, l->subject->subject_list, l);
- LIST_REMOVE(JobDependency, object, l->object->object_list, l);
+ LIST_REMOVE(object, l->object->object_list, l);
free(l);
}
@@ -491,7 +491,7 @@ int job_run_and_invalidate(Job *j) {
assert(j->type < _JOB_TYPE_MAX_IN_TRANSACTION);
assert(j->in_run_queue);
- LIST_REMOVE(Job, run_queue, j->manager->run_queue, j);
+ LIST_REMOVE(run_queue, j->manager->run_queue, j);
j->in_run_queue = false;
if (j->state != JOB_WAITING)
@@ -910,7 +910,7 @@ void job_add_to_run_queue(Job *j) {
if (j->in_run_queue)
return;
- LIST_PREPEND(Job, run_queue, j->manager->run_queue, j);
+ LIST_PREPEND(run_queue, j->manager->run_queue, j);
j->in_run_queue = true;
}
@@ -925,7 +925,7 @@ void job_add_to_dbus_queue(Job *j) {
* job might just have been created and not yet assigned to a
* connection/client. */
- LIST_PREPEND(Job, dbus_queue, j->manager->dbus_job_queue, j);
+ LIST_PREPEND(dbus_queue, j->manager->dbus_job_queue, j);
j->in_dbus_queue = true;
}
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index f01843d65e..fb7efcaa88 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -300,10 +300,10 @@ int config_parse_socket_listen(const char *unit,
p->fd = -1;
if (s->ports) {
- LIST_FIND_TAIL(SocketPort, port, s->ports, tail);
- LIST_INSERT_AFTER(SocketPort, port, s->ports, tail, p);
+ LIST_FIND_TAIL(port, s->ports, tail);
+ LIST_INSERT_AFTER(port, s->ports, tail, p);
} else
- LIST_PREPEND(SocketPort, port, s->ports, p);
+ LIST_PREPEND(port, s->ports, p);
return 0;
}
@@ -1203,7 +1203,7 @@ int config_parse_timer(const char *unit,
v->value = u;
v->calendar_spec = c;
- LIST_PREPEND(TimerValue, value, t->values, v);
+ LIST_PREPEND(value, t->values, v);
return 0;
}
@@ -1323,7 +1323,7 @@ int config_parse_path_spec(const char *unit,
s->type = b;
s->inotify_fd = -1;
- LIST_PREPEND(PathSpec, spec, p->specs, s);
+ LIST_PREPEND(spec, p->specs, s);
return 0;
}
@@ -1657,7 +1657,7 @@ int config_parse_unit_condition_path(const char *unit,
if (!c)
return log_oom();
- LIST_PREPEND(Condition, conditions, u->conditions, c);
+ LIST_PREPEND(conditions, u->conditions, c);
return 0;
}
@@ -1712,7 +1712,7 @@ int config_parse_unit_condition_string(const char *unit,
if (!c)
return log_oom();
- LIST_PREPEND(Condition, conditions, u->conditions, c);
+ LIST_PREPEND(conditions, u->conditions, c);
return 0;
}
@@ -1766,7 +1766,7 @@ int config_parse_unit_condition_null(const char *unit,
if (!c)
return log_oom();
- LIST_PREPEND(Condition, conditions, u->conditions, c);
+ LIST_PREPEND(conditions, u->conditions, c);
return 0;
}
@@ -2128,7 +2128,7 @@ int config_parse_device_allow(
a->w = !!strchr(m, 'w');
a->m = !!strchr(m, 'm');
- LIST_PREPEND(CGroupDeviceAllow, device_allow, c->device_allow, a);
+ LIST_PREPEND(device_allow, c->device_allow, a);
return 0;
}
@@ -2234,7 +2234,7 @@ int config_parse_blockio_device_weight(
w->weight = lu;
- LIST_PREPEND(CGroupBlockIODeviceWeight, device_weights, c->blockio_device_weights, w);
+ LIST_PREPEND(device_weights, c->blockio_device_weights, w);
return 0;
}
@@ -2310,7 +2310,7 @@ int config_parse_blockio_bandwidth(
b->bandwidth = (uint64_t) bytes;
b->read = read;
- LIST_PREPEND(CGroupBlockIODeviceBandwidth, device_bandwidths, c->blockio_device_bandwidths, b);
+ LIST_PREPEND(device_bandwidths, c->blockio_device_bandwidths, b);
return 0;
}
diff --git a/src/core/manager.c b/src/core/manager.c
index 56191bfc7c..01db2b0be9 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -676,7 +676,7 @@ static unsigned manager_dispatch_gc_queue(Manager *m) {
unit_gc_sweep(u, gc_marker);
- LIST_REMOVE(Unit, gc_queue, m->gc_queue, u);
+ LIST_REMOVE(gc_queue, m->gc_queue, u);
u->in_gc_queue = false;
n++;
diff --git a/src/core/path.c b/src/core/path.c
index 99e2fedf29..10df80f695 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -283,7 +283,7 @@ void path_free_specs(Path *p) {
while ((s = p->specs)) {
path_spec_unwatch(s, UNIT(p));
- LIST_REMOVE(PathSpec, spec, p->specs, s);
+ LIST_REMOVE(spec, p->specs, s);
path_spec_done(s);
free(s);
}
diff --git a/src/core/socket.c b/src/core/socket.c
index ae92408560..0c03e83818 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -110,7 +110,7 @@ void socket_free_ports(Socket *s) {
assert(s);
while ((p = s->ports)) {
- LIST_REMOVE(SocketPort, port, s->ports, p);
+ LIST_REMOVE(port, s->ports, p);
if (p->fd >= 0) {
unit_unwatch_fd(UNIT(s), &p->fd_watch);
diff --git a/src/core/swap.c b/src/core/swap.c
index a68ab7cdf8..8e494e9b5a 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -66,7 +66,7 @@ static void swap_unset_proc_swaps(Swap *s) {
* same kernel swap device. */
swaps = UNIT(s)->manager->swaps_by_proc_swaps;
first = hashmap_get(swaps, s->parameters_proc_swaps.what);
- LIST_REMOVE(Swap, same_proc_swaps, first, s);
+ LIST_REMOVE(same_proc_swaps, first, s);
if (first)
hashmap_remove_and_replace(swaps,
@@ -364,7 +364,7 @@ static int swap_add_one(
p->what = wp;
first = hashmap_get(m->swaps_by_proc_swaps, wp);
- LIST_PREPEND(Swap, same_proc_swaps, first, SWAP(u));
+ LIST_PREPEND(same_proc_swaps, first, SWAP(u));
r = hashmap_replace(m->swaps_by_proc_swaps, wp, first);
if (r < 0)
diff --git a/src/core/timer.c b/src/core/timer.c
index 9166c1e2fc..b90c85f823 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -54,7 +54,7 @@ void timer_free_values(Timer *t) {
assert(t);
while ((v = t->values)) {
- LIST_REMOVE(TimerValue, value, t->values, v);
+ LIST_REMOVE(value, t->values, v);
if (v->calendar_spec)
calendar_spec_free(v->calendar_spec);
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 203070fa26..ba7d8d9828 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -775,10 +775,10 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b
j->override = override;
j->irreversible = tr->irreversible;
- LIST_PREPEND(Job, transaction, f, j);
+ LIST_PREPEND(transaction, f, j);
if (hashmap_replace(tr->jobs, unit, f) < 0) {
- LIST_REMOVE(Job, transaction, f, j);
+ LIST_REMOVE(transaction, f, j);
job_free(j);
return NULL;
}
diff --git a/src/core/umount.c b/src/core/umount.c
index 99dbe27c8f..e7460cb6bf 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -40,14 +40,14 @@
typedef struct MountPoint {
char *path;
dev_t devnum;
- LIST_FIELDS (struct MountPoint, mount_point);
+ LIST_FIELDS(struct MountPoint, mount_point);
} MountPoint;
static void mount_point_free(MountPoint **head, MountPoint *m) {
assert(head);
assert(m);
- LIST_REMOVE(MountPoint, mount_point, *head, m);
+ LIST_REMOVE(mount_point, *head, m);
free(m->path);
free(m);
@@ -125,7 +125,7 @@ static int mount_points_list_get(MountPoint **head) {
}
m->path = p;
- LIST_PREPEND(MountPoint, mount_point, *head, m);
+ LIST_PREPEND(mount_point, *head, m);
}
r = 0;
@@ -190,7 +190,7 @@ static int swap_list_get(MountPoint **head) {
}
swap->path = d;
- LIST_PREPEND(MountPoint, mount_point, *head, swap);
+ LIST_PREPEND(mount_point, *head, swap);
}
r = 0;
@@ -250,7 +250,7 @@ static int loopback_list_get(MountPoint **head) {
}
lb->path = loop;
- LIST_PREPEND(MountPoint, mount_point, *head, lb);
+ LIST_PREPEND(mount_point, *head, lb);
}
return 0;
@@ -308,7 +308,7 @@ static int dm_list_get(MountPoint **head) {
m->path = node;
m->devnum = devnum;
- LIST_PREPEND(MountPoint, mount_point, *head, m);
+ LIST_PREPEND(mount_point, *head, m);
}
return 0;
@@ -513,7 +513,7 @@ int umount_all(bool *changed) {
bool umount_changed;
LIST_HEAD(MountPoint, mp_list_head);
- LIST_HEAD_INIT(MountPoint, mp_list_head);
+ LIST_HEAD_INIT(mp_list_head);
r = mount_points_list_get(&mp_list_head);
if (r < 0)
goto end;
@@ -543,7 +543,7 @@ int swapoff_all(bool *changed) {
int r;
LIST_HEAD(MountPoint, swap_list_head);
- LIST_HEAD_INIT(MountPoint, swap_list_head);
+ LIST_HEAD_INIT(swap_list_head);
r = swap_list_get(&swap_list_head);
if (r < 0)
@@ -561,7 +561,7 @@ int loopback_detach_all(bool *changed) {
int r;
LIST_HEAD(MountPoint, loopback_list_head);
- LIST_HEAD_INIT(MountPoint, loopback_list_head);
+ LIST_HEAD_INIT(loopback_list_head);
r = loopback_list_get(&loopback_list_head);
if (r < 0)
@@ -579,7 +579,7 @@ int dm_detach_all(bool *changed) {
int r;
LIST_HEAD(MountPoint, dm_list_head);
- LIST_HEAD_INIT(MountPoint, dm_list_head);
+ LIST_HEAD_INIT(dm_list_head);
r = dm_list_get(&dm_list_head);
if (r < 0)
diff --git a/src/core/unit.c b/src/core/unit.c
index 1db7d061c4..e19d281aa7 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -171,7 +171,7 @@ int unit_add_name(Unit *u, const char *text) {
u->id = s;
u->instance = i;
- LIST_PREPEND(Unit, units_by_type, u->manager->units_by_type[t], u);
+ LIST_PREPEND(units_by_type, u->manager->units_by_type[t], u);
if (UNIT_VTABLE(u)->init)
UNIT_VTABLE(u)->init(u);
@@ -284,7 +284,7 @@ void unit_add_to_load_queue(Unit *u) {
if (u->load_state != UNIT_STUB || u->in_load_queue)
return;
- LIST_PREPEND(Unit, load_queue, u->manager->load_queue, u);
+ LIST_PREPEND(load_queue, u->manager->load_queue, u);
u->in_load_queue = true;
}
@@ -294,7 +294,7 @@ void unit_add_to_cleanup_queue(Unit *u) {
if (u->in_cleanup_queue)
return;
- LIST_PREPEND(Unit, cleanup_queue, u->manager->cleanup_queue, u);
+ LIST_PREPEND(cleanup_queue, u->manager->cleanup_queue, u);
u->in_cleanup_queue = true;
}
@@ -307,7 +307,7 @@ void unit_add_to_gc_queue(Unit *u) {
if (unit_check_gc(u))
return;
- LIST_PREPEND(Unit, gc_queue, u->manager->gc_queue, u);
+ LIST_PREPEND(gc_queue, u->manager->gc_queue, u);
u->in_gc_queue = true;
u->manager->n_in_gc_queue ++;
@@ -326,7 +326,7 @@ void unit_add_to_dbus_queue(Unit *u) {
return;
}
- LIST_PREPEND(Unit, dbus_queue, u->manager->dbus_unit_queue, u);
+ LIST_PREPEND(dbus_queue, u->manager->dbus_unit_queue, u);
u->in_dbus_queue = true;
}
@@ -439,24 +439,24 @@ void unit_free(Unit *u) {
bidi_set_free(u, u->dependencies[d]);
if (u->type != _UNIT_TYPE_INVALID)
- LIST_REMOVE(Unit, units_by_type, u->manager->units_by_type[u->type], u);
+ LIST_REMOVE(units_by_type, u->manager->units_by_type[u->type], u);
if (u->in_load_queue)
- LIST_REMOVE(Unit, load_queue, u->manager->load_queue, u);
+ LIST_REMOVE(load_queue, u->manager->load_queue, u);
if (u->in_dbus_queue)
- LIST_REMOVE(Unit, dbus_queue, u->manager->dbus_unit_queue, u);
+ LIST_REMOVE(dbus_queue, u->manager->dbus_unit_queue, u);
if (u->in_cleanup_queue)
- LIST_REMOVE(Unit, cleanup_queue, u->manager->cleanup_queue, u);
+ LIST_REMOVE(cleanup_queue, u->manager->cleanup_queue, u);
if (u->in_gc_queue) {
- LIST_REMOVE(Unit, gc_queue, u->manager->gc_queue, u);
+ LIST_REMOVE(gc_queue, u->manager->gc_queue, u);
u->manager->n_in_gc_queue--;
}
if (u->in_cgroup_queue)
- LIST_REMOVE(Unit, cgroup_queue, u->manager->cgroup_queue, u);
+ LIST_REMOVE(cgroup_queue, u->manager->cgroup_queue, u);
if (u->cgroup_path) {
hashmap_remove(u->manager->cgroup_unit, u->cgroup_path);
@@ -952,7 +952,7 @@ int unit_load(Unit *u) {
assert(u);
if (u->in_load_queue) {
- LIST_REMOVE(Unit, load_queue, u->manager->load_queue, u);
+ LIST_REMOVE(load_queue, u->manager->load_queue, u);
u->in_load_queue = false;
}
@@ -2670,7 +2670,7 @@ Unit* unit_ref_set(UnitRef *ref, Unit *u) {
unit_ref_unset(ref);
ref->unit = u;
- LIST_PREPEND(UnitRef, refs, u->refs, ref);
+ LIST_PREPEND(refs, u->refs, ref);
return u;
}
@@ -2680,7 +2680,7 @@ void unit_ref_unset(UnitRef *ref) {
if (!ref->unit)
return;
- LIST_REMOVE(UnitRef, refs, ref->unit->refs, ref);
+ LIST_REMOVE(refs, ref->unit->refs, ref);
ref->unit = NULL;
}
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index ec33040509..d5411bde2f 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -251,7 +251,7 @@ static void fifo_free(Fifo *f) {
if (f->server) {
assert(f->server->n_fifos > 0);
f->server->n_fifos--;
- LIST_REMOVE(Fifo, fifo, f->server->fifos, f);
+ LIST_REMOVE(fifo, f->server->fifos, f);
}
if (f->fd >= 0) {
@@ -341,7 +341,7 @@ static int server_init(Server *s, unsigned n_sockets) {
}
f->fd = fd;
- LIST_PREPEND(Fifo, fifo, s->fifos, f);
+ LIST_PREPEND(fifo, s->fifos, f);
f->server = s;
s->n_fifos ++;
}
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c
index 32e35a926d..4b76221527 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -96,8 +96,8 @@ static void journal_rate_limit_group_free(JournalRateLimitGroup *g) {
if (g->parent->lru_tail == g)
g->parent->lru_tail = g->lru_prev;
- LIST_REMOVE(JournalRateLimitGroup, lru, g->parent->lru, g);
- LIST_REMOVE(JournalRateLimitGroup, bucket, g->parent->buckets[g->hash % BUCKETS_MAX], g);
+ LIST_REMOVE(lru, g->parent->lru, g);
+ LIST_REMOVE(bucket, g->parent->buckets[g->hash % BUCKETS_MAX], g);
g->parent->n_groups --;
}
@@ -156,8 +156,8 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
journal_rate_limit_vacuum(r, ts);
- LIST_PREPEND(JournalRateLimitGroup, bucket, r->buckets[g->hash % BUCKETS_MAX], g);
- LIST_PREPEND(JournalRateLimitGroup, lru, r->lru, g);
+ LIST_PREPEND(bucket, r->buckets[g->hash % BUCKETS_MAX], g);
+ LIST_PREPEND(lru, r->lru, g);
if (!g->lru_next)
r->lru_tail = g;
r->n_groups ++;
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index 543614aead..9ca26e26d6 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -324,7 +324,7 @@ void stdout_stream_free(StdoutStream *s) {
if (s->server) {
assert(s->server->n_stdout_streams > 0);
s->server->n_stdout_streams --;
- LIST_REMOVE(StdoutStream, stdout_stream, s->server->stdout_streams, s);
+ LIST_REMOVE(stdout_stream, s->server->stdout_streams, s);
}
if (s->fd >= 0) {
@@ -404,7 +404,7 @@ int stdout_stream_new(Server *s) {
}
stream->server = s;
- LIST_PREPEND(StdoutStream, stdout_stream, s->stdout_streams, stream);
+ LIST_PREPEND(stdout_stream, s->stdout_streams, stream);
s->n_stdout_streams ++;
return 0;
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 03b57beb04..6c9194a1a5 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -110,13 +110,13 @@ static void window_unlink(Window *w) {
munmap(w->ptr, w->size);
if (w->fd)
- LIST_REMOVE(Window, by_fd, w->fd->windows, w);
+ LIST_REMOVE(by_fd, w->fd->windows, w);
if (w->in_unused) {
if (w->cache->last_unused == w)
w->cache->last_unused = w->unused_prev;
- LIST_REMOVE(Window, unused, w->cache->unused, w);
+ LIST_REMOVE(unused, w->cache->unused, w);
}
LIST_FOREACH(by_window, c, w->contexts) {
@@ -180,11 +180,11 @@ static void context_detach_window(Context *c) {
w = c->window;
c->window = NULL;
- LIST_REMOVE(Context, by_window, w->contexts, c);
+ LIST_REMOVE(by_window, w->contexts, c);
if (!w->contexts && !w->keep_always) {
/* Not used anymore? */
- LIST_PREPEND(Window, unused, c->cache->unused, w);
+ LIST_PREPEND(unused, c->cache->unused, w);
if (!c->cache->last_unused)
c->cache->last_unused = w;
@@ -203,7 +203,7 @@ static void context_attach_window(Context *c, Window *w) {
if (w->in_unused) {
/* Used again? */
- LIST_REMOVE(Window, unused, c->cache->unused, w);
+ LIST_REMOVE(unused, c->cache->unused, w);
if (c->cache->last_unused == w)
c->cache->last_unused = w->unused_prev;
@@ -211,7 +211,7 @@ static void context_attach_window(Context *c, Window *w) {
}
c->window = w;
- LIST_PREPEND(Context, by_window, w->contexts, c);
+ LIST_PREPEND(by_window, w->contexts, c);
}
static Context *context_add(MMapCache *m, unsigned id) {
@@ -511,11 +511,11 @@ static int add_mmap(
w->size = wsize;
w->fd = f;
- LIST_PREPEND(Window, by_fd, f->windows, w);
+ LIST_PREPEND(by_fd, f->windows, w);
context_detach_window(c);
c->window = w;
- LIST_PREPEND(Context, by_window, w->contexts, c);
+ LIST_PREPEND(by_window, w->contexts, c);
*ret = (uint8_t*) w->ptr + (offset - w->offset);
return 1;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 7700d6cb12..3ccb14a242 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -186,7 +186,7 @@ static Match *match_new(Match *p, MatchType t) {
if (p) {
m->parent = p;
- LIST_PREPEND(Match, matches, p->matches, m);
+ LIST_PREPEND(matches, p->matches, m);
}
return m;
@@ -199,7 +199,7 @@ static void match_free(Match *m) {
match_free(m->matches);
if (m->parent)
- LIST_REMOVE(Match, matches, m->parent->matches, m);
+ LIST_REMOVE(matches, m->parent->matches, m);
free(m->data);
free(m);
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;
}
diff --git a/src/login/logind-device.c b/src/login/logind-device.c
index 95c2307baf..9ff91ba035 100644
--- a/src/login/logind-device.c
+++ b/src/login/logind-device.c
@@ -77,7 +77,7 @@ void device_detach(Device *d) {
session_device_free(sd);
s = d->seat;
- LIST_REMOVE(Device, devices, d->seat->devices, d);
+ LIST_REMOVE(devices, d->seat->devices, d);
d->seat = NULL;
if (!seat_has_master_device(s)) {
@@ -110,11 +110,11 @@ void device_attach(Device *d, Seat *s) {
* per seat, so we iterate only a few times. */
if (d->master || !s->devices)
- LIST_PREPEND(Device, devices, s->devices, d);
+ LIST_PREPEND(devices, s->devices, d);
else {
LIST_FOREACH(devices, i, s->devices) {
if (!i->devices_next || !i->master) {
- LIST_INSERT_AFTER(Device, devices, s->devices, i, d);
+ LIST_INSERT_AFTER(devices, s->devices, i, d);
break;
}
}
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index feebcf4558..6f3299bbad 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -67,7 +67,7 @@ void seat_free(Seat *s) {
assert(s);
if (s->in_gc_queue)
- LIST_REMOVE(Seat, gc_queue, s->manager->seat_gc_queue, s);
+ LIST_REMOVE(gc_queue, s->manager->seat_gc_queue, s);
while (s->sessions)
session_free(s->sessions);
@@ -415,7 +415,7 @@ int seat_attach_session(Seat *s, Session *session) {
assert(!session->seat);
session->seat = s;
- LIST_PREPEND(Session, sessions_by_seat, s->sessions, session);
+ LIST_PREPEND(sessions_by_seat, s->sessions, session);
seat_send_changed(s, "Sessions\0");
@@ -533,7 +533,7 @@ void seat_add_to_gc_queue(Seat *s) {
if (s->in_gc_queue)
return;
- LIST_PREPEND(Seat, gc_queue, s->manager->seat_gc_queue, s);
+ LIST_PREPEND(gc_queue, s->manager->seat_gc_queue, s);
s->in_gc_queue = true;
}
diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
index 6605935f3c..f1578bda96 100644
--- a/src/login/logind-session-device.c
+++ b/src/login/logind-session-device.c
@@ -390,7 +390,7 @@ int session_device_new(Session *s, dev_t dev, SessionDevice **out) {
}
sd->fd = r;
- LIST_PREPEND(SessionDevice, sd_by_device, sd->device->session_devices, sd);
+ LIST_PREPEND(sd_by_device, sd->device->session_devices, sd);
*out = sd;
return 0;
@@ -409,7 +409,7 @@ void session_device_free(SessionDevice *sd) {
session_device_notify(sd, SESSION_DEVICE_RELEASE);
close_nointr_nofail(sd->fd);
- LIST_REMOVE(SessionDevice, sd_by_device, sd->device->session_devices, sd);
+ LIST_REMOVE(sd_by_device, sd->device->session_devices, sd);
hashmap_remove(sd->session->devices, &sd->dev);
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 27aa335142..8a021f32a1 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -96,7 +96,7 @@ void session_free(Session *s) {
assert(s);
if (s->in_gc_queue)
- LIST_REMOVE(Session, gc_queue, s->manager->session_gc_queue, s);
+ LIST_REMOVE(gc_queue, s->manager->session_gc_queue, s);
session_drop_controller(s);
@@ -106,7 +106,7 @@ void session_free(Session *s) {
hashmap_free(s->devices);
if (s->user) {
- LIST_REMOVE(Session, sessions_by_user, s->user->sessions, s);
+ LIST_REMOVE(sessions_by_user, s->user->sessions, s);
if (s->user->display == s)
s->user->display = NULL;
@@ -118,7 +118,7 @@ void session_free(Session *s) {
if (s->seat->pending_switch == s)
s->seat->pending_switch = NULL;
- LIST_REMOVE(Session, sessions_by_seat, s->seat->sessions, s);
+ LIST_REMOVE(sessions_by_seat, s->seat->sessions, s);
}
if (s->scope) {
@@ -149,7 +149,7 @@ void session_set_user(Session *s, User *u) {
assert(!s->user);
s->user = u;
- LIST_PREPEND(Session, sessions_by_user, u->sessions, s);
+ LIST_PREPEND(sessions_by_user, u->sessions, s);
}
int session_save(Session *s) {
@@ -938,7 +938,7 @@ void session_add_to_gc_queue(Session *s) {
if (s->in_gc_queue)
return;
- LIST_PREPEND(Session, gc_queue, s->manager->session_gc_queue, s);
+ LIST_PREPEND(gc_queue, s->manager->session_gc_queue, s);
s->in_gc_queue = true;
}
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index adbe638d46..54ee1cbed0 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -72,7 +72,7 @@ void user_free(User *u) {
assert(u);
if (u->in_gc_queue)
- LIST_REMOVE(User, gc_queue, u->manager->user_gc_queue, u);
+ LIST_REMOVE(gc_queue, u->manager->user_gc_queue, u);
while (u->sessions)
session_free(u->sessions);
@@ -644,7 +644,7 @@ void user_add_to_gc_queue(User *u) {
if (u->in_gc_queue)
return;
- LIST_PREPEND(User, gc_queue, u->manager->user_gc_queue, u);
+ LIST_PREPEND(gc_queue, u->manager->user_gc_queue, u);
u->in_gc_queue = true;
}
diff --git a/src/login/logind.c b/src/login/logind.c
index 0628032ae5..06db2db6fb 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -929,7 +929,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
assert(m);
while ((seat = m->seat_gc_queue)) {
- LIST_REMOVE(Seat, gc_queue, m->seat_gc_queue, seat);
+ LIST_REMOVE(gc_queue, m->seat_gc_queue, seat);
seat->in_gc_queue = false;
if (seat_check_gc(seat, drop_not_started) == 0) {
@@ -939,7 +939,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
}
while ((session = m->session_gc_queue)) {
- LIST_REMOVE(Session, gc_queue, m->session_gc_queue, session);
+ LIST_REMOVE(gc_queue, m->session_gc_queue, session);
session->in_gc_queue = false;
if (session_check_gc(session, drop_not_started) == 0) {
@@ -950,7 +950,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
}
while ((user = m->user_gc_queue)) {
- LIST_REMOVE(User, gc_queue, m->user_gc_queue, user);
+ LIST_REMOVE(gc_queue, m->user_gc_queue, user);
user->in_gc_queue = false;
if (user_check_gc(user, drop_not_started) == 0) {
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 602aa18be6..f78b0cf8fd 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -73,7 +73,7 @@ void machine_free(Machine *m) {
assert(m);
if (m->in_gc_queue)
- LIST_REMOVE(Machine, gc_queue, m->manager->machine_gc_queue, m);
+ LIST_REMOVE(gc_queue, m->manager->machine_gc_queue, m);
if (m->scope) {
hashmap_remove(m->manager->machine_units, m->scope);
@@ -369,7 +369,7 @@ void machine_add_to_gc_queue(Machine *m) {
if (m->in_gc_queue)
return;
- LIST_PREPEND(Machine, gc_queue, m->manager->machine_gc_queue, m);
+ LIST_PREPEND(gc_queue, m->manager->machine_gc_queue, m);
m->in_gc_queue = true;
}
diff --git a/src/machine/machined.c b/src/machine/machined.c
index ad804a1e14..ca84f8a004 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -249,7 +249,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
assert(m);
while ((machine = m->machine_gc_queue)) {
- LIST_REMOVE(Machine, gc_queue, m->machine_gc_queue, machine);
+ LIST_REMOVE(gc_queue, m->machine_gc_queue, machine);
machine->in_gc_queue = false;
if (machine_check_gc(machine, drop_not_started) == 0) {
diff --git a/src/shared/list.h b/src/shared/list.h
index 476757460a..e55b91cea4 100644
--- a/src/shared/list.h
+++ b/src/shared/list.h
@@ -31,23 +31,23 @@
t *name##_next, *name##_prev
/* Initialize the list's head */
-#define LIST_HEAD_INIT(t,head) \
+#define LIST_HEAD_INIT(head) \
do { \
(head) = NULL; } \
while(false)
/* Initialize a list item */
-#define LIST_INIT(t,name,item) \
+#define LIST_INIT(name,item) \
do { \
- t *_item = (item); \
+ typeof(*(item)) *_item = (item); \
assert(_item); \
_item->name##_prev = _item->name##_next = NULL; \
} while(false)
/* Prepend an item to the list */
-#define LIST_PREPEND(t,name,head,item) \
+#define LIST_PREPEND(name,head,item) \
do { \
- t **_head = &(head), *_item = (item); \
+ typeof(*(head)) **_head = &(head), *_item = (item); \
assert(_item); \
if ((_item->name##_next = *_head)) \
_item->name##_next->name##_prev = _item; \
@@ -56,9 +56,9 @@
} while(false)
/* Remove an item from the list */
-#define LIST_REMOVE(t,name,head,item) \
+#define LIST_REMOVE(name,head,item) \
do { \
- t **_head = &(head), *_item = (item); \
+ typeof(*(head)) **_head = &(head), *_item = (item); \
assert(_item); \
if (_item->name##_next) \
_item->name##_next->name##_prev = _item->name##_prev; \
@@ -72,9 +72,9 @@
} while(false)
/* Find the head of the list */
-#define LIST_FIND_HEAD(t,name,item,head) \
+#define LIST_FIND_HEAD(name,item,head) \
do { \
- t *_item = (item); \
+ typeof(*(item)) *_item = (item); \
assert(_item); \
while (_item->name##_prev) \
_item = _item->name##_prev; \
@@ -82,9 +82,9 @@
} while (false)
/* Find the tail of the list */
-#define LIST_FIND_TAIL(t,name,item,tail) \
+#define LIST_FIND_TAIL(name,item,tail) \
do { \
- t *_item = (item); \
+ typeof(*(item)) *_item = (item); \
assert(_item); \
while (_item->name##_next) \
_item = _item->name##_next; \
@@ -92,9 +92,9 @@
} while (false)
/* Insert an item after another one (a = where, b = what) */
-#define LIST_INSERT_AFTER(t,name,head,a,b) \
+#define LIST_INSERT_AFTER(name,head,a,b) \
do { \
- t **_head = &(head), *_a = (a), *_b = (b); \
+ typeof(*(head)) **_head = &(head), *_a = (a), *_b = (b); \
assert(_b); \
if (!_a) { \
if ((_b->name##_next = *_head)) \
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index a8a86edd1f..d458c6588d 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3019,7 +3019,7 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
return r;
}
- LIST_PREPEND(ExecStatusInfo, exec, i->exec, info);
+ LIST_PREPEND(exec, i->exec, info);
dbus_message_iter_next(&sub);
}
@@ -3474,7 +3474,7 @@ static int show_one(const char *verb,
}
while ((p = info.exec)) {
- LIST_REMOVE(ExecStatusInfo, exec, info.exec, p);
+ LIST_REMOVE(exec, info.exec, p);
exec_status_info_free(p);
}
diff --git a/src/test/test-list.c b/src/test/test-list.c
index 2710504765..fa52ad1db8 100644
--- a/src/test/test-list.c
+++ b/src/test/test-list.c
@@ -29,13 +29,13 @@ int main(int argc, const char *argv[]) {
list_item items[4];
list_item *cursor;
- LIST_HEAD_INIT(list_item, head);
+ LIST_HEAD_INIT(head);
assert_se(head == NULL);
for (i = 0; i < ELEMENTSOF(items); i++) {
- LIST_INIT(list_item, item, &items[i]);
+ LIST_INIT(item, &items[i]);
assert_se(LIST_JUST_US(item, &items[i]));
- LIST_PREPEND(list_item, item, head, &items[i]);
+ LIST_PREPEND(item, head, &items[i]);
}
assert_se(!LIST_JUST_US(item, head));
@@ -50,13 +50,13 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_FIND_HEAD(list_item, item, &items[0], cursor);
+ LIST_FIND_HEAD(item, &items[0], cursor);
assert_se(cursor == &items[3]);
- LIST_FIND_TAIL(list_item, item, &items[3], cursor);
+ LIST_FIND_TAIL(item, &items[3], cursor);
assert_se(cursor == &items[0]);
- LIST_REMOVE(list_item, item, head, &items[1]);
+ LIST_REMOVE(item, head, &items[1]);
assert_se(LIST_JUST_US(item, &items[1]));
assert_se(items[0].item_next == NULL);
@@ -67,7 +67,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_INSERT_AFTER(list_item, item, head, &items[3], &items[1]);
+ LIST_INSERT_AFTER(item, head, &items[3], &items[1]);
assert_se(items[0].item_next == NULL);
assert_se(items[2].item_next == &items[0]);
assert_se(items[1].item_next == &items[2]);
@@ -78,7 +78,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[1].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[0]);
+ LIST_REMOVE(item, head, &items[0]);
assert_se(LIST_JUST_US(item, &items[0]));
assert_se(items[2].item_next == NULL);
@@ -89,7 +89,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[1].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[1]);
+ LIST_REMOVE(item, head, &items[1]);
assert_se(LIST_JUST_US(item, &items[1]));
assert_se(items[2].item_next == NULL);
@@ -98,11 +98,11 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[2]);
+ LIST_REMOVE(item, head, &items[2]);
assert_se(LIST_JUST_US(item, &items[2]));
assert_se(LIST_JUST_US(item, head));
- LIST_REMOVE(list_item, item, head, &items[3]);
+ LIST_REMOVE(item, head, &items[3]);
assert_se(LIST_JUST_US(item, &items[3]));
return 0;