chiark / gitweb /
list: make our list macros a bit easier to use by not requring type spec on each...
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Oct 2013 04:10:14 +0000 (06:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Oct 2013 04:11:19 +0000 (06:11 +0200)
We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use.

38 files changed:
TODO
src/bootchart/bootchart.c
src/bootchart/svg.c
src/core/cgroup.c
src/core/dbus-cgroup.c
src/core/dbus-job.c
src/core/dbus-unit.c
src/core/dbus.c
src/core/device.c
src/core/execute.c
src/core/job.c
src/core/load-fragment.c
src/core/manager.c
src/core/path.c
src/core/socket.c
src/core/swap.c
src/core/timer.c
src/core/transaction.c
src/core/umount.c
src/core/unit.c
src/initctl/initctl.c
src/journal/journald-rate-limit.c
src/journal/journald-stream.c
src/journal/mmap-cache.c
src/journal/sd-journal.c
src/libsystemd-bus/bus-objects.c
src/libsystemd-bus/sd-bus.c
src/login/logind-device.c
src/login/logind-seat.c
src/login/logind-session-device.c
src/login/logind-session.c
src/login/logind-user.c
src/login/logind.c
src/machine/machine.c
src/machine/machined.c
src/shared/list.h
src/systemctl/systemctl.c
src/test/test-list.c

diff --git a/TODO b/TODO
index 66cd5b4f2289e300aa00dcaec6c10f78e863c140..3926fe5baade9ea6c2ee92ea3064681beecfe87d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -58,8 +58,6 @@ Features:
 
 * tmpfiles: when applying ownership to /run/log/journal also do this for the journal fails contained in it
 
-* rework list.h to use typeof() and thus simplify most linked list macros by not requring the type to be specified
-
 * we probably should replace the left-over uses of strv_append() and replace them by strv_push() or strv_extend()
 
 * move config_parse_path_strv() out of conf-parser.c
index edbd3815cd508f8c9da1c71196c4d95d72b79700..1f40c2edf4e00288539fa918fba64b8cea26569c 100644 (file)
@@ -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 */
index 7ac0138a2b695dce1fba75ecabceb7d45eb49cc3..c088cad7f572c422bd9b64d635910fe905f7874b 100644 (file)
@@ -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;
index 8bf4d896deaf843603c2415d22a789ae5986f02f..f0a97e6818263d039237dbdb691263048ff2dd07 100644 (file)
@@ -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;
 }
 
index 9ebcad9da6934b4f5999194e93ac2396cb367afb..5654b8c7119e4279c99fe07e881d17bf32766d40 100644 (file)
@@ -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++;
index 4ab88d06c3eb31b6927e3031e4bed9440931f75f..eac24489159f0da1aca30ea3fc7eeb9d686eb634 100644 (file)
@@ -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;
         }
 
index 2ea59b2913883170185460ad96b96eef81d5e41c..b6f5c398100aaf7fd66e89890c2894fab10eb75f 100644 (file)
@@ -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)
index aa3d93bf06f315a342970a56a8958ab5a4f798cc..771ba01f675aae0d482541c7e2d0006c0b9ad13f 100644 (file)
@@ -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);
                         }
                 }
index 25af2cb2d59533c66c63686c6b75295dd8b1308a..05950153d3c531a70ec335278f40da18ca76d630 100644 (file)
@@ -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)
index 3f7ca52139801ddc2606257100fa4d07b1618719..b48b1ae513baa3c8a7be940b7c6c99baff4be0b4 100644 (file)
@@ -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;
 }
index bf1d95690824818c593ff900a55ab479d40746d2..e5dcef7cf43d9f616665072f4e675028ecc711b3 100644 (file)
@@ -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;
 }
 
index f01843d65e77e28acbb984092ef6ec286f81f292..fb7efcaa8880f7cfac76037d6ae65caf4761541e 100644 (file)
@@ -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;
 }
index 56191bfc7c340d46ccfac6097f30ccdf550848c9..01db2b0be9b640f0372c242ac239aab75b6c482f 100644 (file)
@@ -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++;
index 99e2fedf2989a36095538051f854cb9994ee8b57..10df80f695bec6150e8b660d3849d1259996a3eb 100644 (file)
@@ -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);
         }
index ae92408560a793f21276a8728aa4bad14a1d17ad..0c03e8381826d88f83a6d380ed666b8449498e1d 100644 (file)
@@ -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);
index a68ab7cdf802a749af33db5d659c8b5206f6738c..8e494e9b5a194f2f84a43d3567afae05a4e0e68f 100644 (file)
@@ -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)
index 9166c1e2fc65ac3b450f9587298f1a5eab6e48c1..b90c85f8238a20b771c3441fb607fcb6781d5143 100644 (file)
@@ -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);
index 203070fa2697f90f6e75989fbbff29b722d1b8db..ba7d8d9828087b68b2e3ca06853c955ed180fb7f 100644 (file)
@@ -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;
         }
index 99dbe27c8fe26720cf8fd0b2d18280f3a078de60..e7460cb6bffd14dfaab1cc845ce5182ead92ab56 100644 (file)
 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)
index 1db7d061c4d46437f98a5808c88b3ef0bb1c8272..e19d281aa7eab6aad84ac9a15a48c74b24748c1d 100644 (file)
@@ -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;
 }
 
index ec33040509094b8e584d1159d3a9dd91903d91e5..d5411bde2fe47344e75b5c52fe89a91c6afa3291 100644 (file)
@@ -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 ++;
         }
index 32e35a926dc25eb7189d5d0757cdb51378913a4a..4b7622152735b12bd513f3cb9a27150ca6f2801f 100644 (file)
@@ -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 ++;
index 543614aead0b676c69449c30e40662516d382b9d..9ca26e26d654877869124970b386e315f49d3f62 100644 (file)
@@ -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;
index 03b57beb046fc72019116ea368dc72ccc6cf0872..6c9194a1a5faa9ca24161f1a8d34d747e176f1e7 100644 (file)
@@ -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;
index 7700d6cb128a1cc7de0d2d52a9ec5f9667b65256..3ccb14a242832fa2b4d0e0c903313d40004bed16 100644 (file)
@@ -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);
index 1d32566c3a057b371fa564bf9c4651b7f9796428..cd56d13d6bf4575d37e2944f17eb567bc8285b09 100644 (file)
@@ -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);
index ca687c0a65413a0ac1739b0d37e9d638a0e66ce8..d9f9dfd7fc286c2ad44f0ea1f401e8f012335b1f 100644 (file)
@@ -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;
                 }
index 95c2307baf04cb02cd3aa2402af84d831c11c9f8..9ff91ba03568b2472aee6c229d783d8fcdbf02af 100644 (file)
@@ -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;
                         }
                 }
index feebcf4558febcb23e44ccaf0b07f88f1ba0b832..6f3299bbade725652a7bddeecdb9c5e87edae41e 100644 (file)
@@ -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;
 }
 
index 6605935f3c768d395a5de1ccc285429abc560f52..f1578bda96b2067f69c211852d1f3eecd54e6aec 100644 (file)
@@ -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);
 
index 27aa33514232d67131d8b49040f05a8e508f5e7b..8a021f32a14afa9fdcb45bf1fd93074e073470b9 100644 (file)
@@ -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;
 }
 
index adbe638d46422d73b61ebfa95bdb39ee225ef236..54ee1cbed07b430072168b697d2876309c6df3cf 100644 (file)
@@ -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;
 }
 
index 0628032ae58294a1d07b3a0bd78e3e30d9baa466..06db2db6fb079fa36d0f5d65f665dc5febe64ac7 100644 (file)
@@ -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) {
index 602aa18be670ae3ba127e46104926ae4309f8e1f..f78b0cf8fdc97c568cb4adeb8a5777f024839d17 100644 (file)
@@ -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;
 }
 
index ad804a1e140d5721c99b591e62de1d08f2ce8dcc..ca84f8a0043f14f5b29afd4d2eac126de6e2c72a 100644 (file)
@@ -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) {
index 476757460aa6145c55ccc2873f016d70862582f0..e55b91cea4ad9c0184ee07390ba78a11c9c81a0a 100644 (file)
         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))                 \
index a8a86edd1fbeb647c1ef9639ab21e4e0951297ab..d458c6588dda0ff13900816bd3bf07be2476187a 100644 (file)
@@ -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);
         }
 
index 27105047656ddc3847357fb1f910dc05a5a22c9b..fa52ad1db8d6fad4e7f8fbccc9a9b0eebd43f445 100644 (file)
@@ -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;