1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

logind: use FOREACH_ARRAY() where appropriate

This commit is contained in:
Lennart Poettering 2023-11-27 16:55:31 +01:00 committed by Mike Yuan
parent 6d5743c411
commit d38c0b105b

View File

@ -412,12 +412,14 @@ static int user_update_slice(User *u) {
{ "IOWeight", u->user_record->io_weight },
};
for (size_t i = 0; i < ELEMENTSOF(settings); i++)
if (settings[i].value != UINT64_MAX) {
r = sd_bus_message_append(m, "(sv)", settings[i].name, "t", settings[i].value);
if (r < 0)
return bus_log_create_error(r);
}
FOREACH_ARRAY(st, settings, ELEMENTSOF(settings)) {
if (st->value == UINT64_MAX)
continue;
r = sd_bus_message_append(m, "(sv)", st->name, "t", st->value);
if (r < 0)
return bus_log_create_error(r);
}
r = sd_bus_message_close_container(m);
if (r < 0)