list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() safer

This commit is contained in:
Yu Watanabe
2022-03-19 08:10:29 +09:00
parent 03677889f0
commit 80a226b26b
16 changed files with 33 additions and 30 deletions
+2 -2
View File
@@ -719,7 +719,7 @@ static void device_update_found_by_sysfs(Manager *m, const char *sysfs, DeviceFo
return;
l = hashmap_get(m->devices_by_sysfs, sysfs);
LIST_FOREACH_SAFE(same_sysfs, d, n, l)
LIST_FOREACH(same_sysfs, d, l)
device_update_found_one(d, found, mask);
}
@@ -905,7 +905,7 @@ static void device_propagate_reload_by_sysfs(Manager *m, const char *sysfs) {
assert(sysfs);
l = hashmap_get(m->devices_by_sysfs, sysfs);
LIST_FOREACH_SAFE(same_sysfs, d, n, l) {
LIST_FOREACH(same_sysfs, d, l) {
if (d->state == DEVICE_DEAD)
continue;
+1 -1
View File
@@ -507,7 +507,7 @@ static void service_remove_fd_store(Service *s, const char *name) {
assert(s);
assert(name);
LIST_FOREACH_SAFE(fd_store, fs, n, s->fd_store) {
LIST_FOREACH(fd_store, fs, s->fd_store) {
if (!streq(fs->fdname, name))
continue;