ExecCommand* exec_command_free_list(ExecCommand *c) {
ExecCommand *i;
- while ((i = c)) {
- LIST_REMOVE(command, c, i);
+ while ((i = LIST_POP(command, c))) {
exec_command_done(i);
free(i);
}
assert(m);
- while ((u = m->release_resources_queue)) {
+ while ((u = LIST_POP(release_resources_queue, m->release_resources_queue))) {
assert(u->in_release_resources_queue);
-
- LIST_REMOVE(release_resources_queue, m->release_resources_queue, u);
u->in_release_resources_queue = false;
n++;
gc_marker = m->gc_marker;
- while ((u = m->gc_unit_queue)) {
+ while ((u = LIST_POP(gc_queue, m->gc_unit_queue))) {
assert(u->in_gc_queue);
unit_gc_sweep(u, gc_marker);
- LIST_REMOVE(gc_queue, m->gc_unit_queue, u);
u->in_gc_queue = false;
n++;
assert(m);
- while ((j = m->gc_job_queue)) {
+ while ((j = LIST_POP(gc_queue, m->gc_job_queue))) {
assert(j->in_gc_queue);
-
- LIST_REMOVE(gc_queue, m->gc_job_queue, j);
j->in_gc_queue = false;
n++;
assert(m);
- while ((u = m->stop_when_unneeded_queue)) {
+ while ((u = LIST_POP(stop_when_unneeded_queue, m->stop_when_unneeded_queue))) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
assert(u->in_stop_when_unneeded_queue);
- LIST_REMOVE(stop_when_unneeded_queue, m->stop_when_unneeded_queue, u);
u->in_stop_when_unneeded_queue = false;
n++;
assert(m);
- while ((u = m->start_when_upheld_queue)) {
+ while ((u = LIST_POP(start_when_upheld_queue, m->start_when_upheld_queue))) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
Unit *culprit = NULL;
assert(u->in_start_when_upheld_queue);
- LIST_REMOVE(start_when_upheld_queue, m->start_when_upheld_queue, u);
u->in_start_when_upheld_queue = false;
n++;
assert(m);
- while ((u = m->stop_when_bound_queue)) {
+ while ((u = LIST_POP(stop_when_bound_queue, m->stop_when_bound_queue))) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
Unit *culprit = NULL;
assert(u->in_stop_when_bound_queue);
- LIST_REMOVE(stop_when_bound_queue, m->stop_when_bound_queue, u);
u->in_stop_when_bound_queue = false;
n++;
assert(m);
- while ((u = m->target_deps_queue)) {
+ while ((u = LIST_POP(target_deps_queue, m->target_deps_queue))) {
_cleanup_free_ Unit **targets = NULL;
int n_targets;
assert(u->in_target_deps_queue);
- LIST_REMOVE(target_deps_queue, u->manager->target_deps_queue, u);
u->in_target_deps_queue = false;
/* Take an "atomic" snapshot of dependencies here, as the call below will likely modify the
assert(p);
- while ((s = p->specs)) {
+ while ((s = LIST_POP(spec, p->specs))) {
path_spec_unwatch(s);
- LIST_REMOVE(spec, p->specs, s);
path_spec_done(s);
free(s);
}
assert(t);
- while ((v = t->values)) {
- LIST_REMOVE(value, t->values, v);
+ while ((v = LIST_POP(value, t->values))) {
calendar_spec_free(v->calendar_spec);
free(v);
}
}
static sd_dhcp_lease *dhcp_lease_free(sd_dhcp_lease *lease) {
- assert(lease);
-
- while (lease->private_options) {
- struct sd_dhcp_raw_option *option = lease->private_options;
+ struct sd_dhcp_raw_option *option;
- LIST_REMOVE(options, lease->private_options, option);
+ assert(lease);
+ while ((option = LIST_POP(options, lease->private_options))) {
free(option->data);
free(option);
}
assert(m);
- while ((seat = m->seat_gc_queue)) {
- LIST_REMOVE(gc_queue, m->seat_gc_queue, seat);
+ while ((seat = LIST_POP(gc_queue, m->seat_gc_queue))) {
seat->in_gc_queue = false;
if (seat_may_gc(seat, drop_not_started)) {
}
}
- while ((session = m->session_gc_queue)) {
- LIST_REMOVE(gc_queue, m->session_gc_queue, session);
+ while ((session = LIST_POP(gc_queue, m->session_gc_queue))) {
session->in_gc_queue = false;
/* First, if we are not closing yet, initiate stopping. */
}
}
- while ((user = m->user_gc_queue)) {
- LIST_REMOVE(gc_queue, m->user_gc_queue, user);
+ while ((user = LIST_POP(gc_queue, m->user_gc_queue))) {
user->in_gc_queue = false;
/* First step: queue stop jobs */
assert(m);
- while ((machine = m->machine_gc_queue)) {
- LIST_REMOVE(gc_queue, m->machine_gc_queue, machine);
+ while ((machine = LIST_POP(gc_queue, m->machine_gc_queue))) {
machine->in_gc_queue = false;
/* First, if we are not closing yet, initiate stopping */
assert(c);
- while ((i = c->write_queue)) {
- LIST_REMOVE(queue, c->write_queue, i);
+ while ((i = LIST_POP(queue, c->write_queue))) {
(void) save_state_write_one(i);
write_queue_item_free(i);
}
MountOptions* mount_options_free_all(MountOptions *options) {
MountOptions *m;
- while ((m = options)) {
- LIST_REMOVE(mount_options, options, m);
+ while ((m = LIST_POP(mount_options, options))) {
free(m->options);
free(m);
}