mirror of
https://github.com/systemd/systemd.git
synced 2025-01-05 13:18:06 +03:00
various: inline some iterator variables
This commit is contained in:
parent
904447ce5a
commit
4053d11006
@ -152,7 +152,6 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list *list) {
|
||||
else {
|
||||
_cleanup_free_ struct udev_list_entry **buf = NULL;
|
||||
struct udev_list_entry *entry, **p;
|
||||
size_t j;
|
||||
|
||||
buf = new(struct udev_list_entry *, n);
|
||||
if (!buf)
|
||||
@ -164,7 +163,7 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list *list) {
|
||||
|
||||
typesafe_qsort(buf, n, udev_list_entry_compare_func);
|
||||
|
||||
for (j = n; j > 0; j--)
|
||||
for (size_t j = n; j > 0; j--)
|
||||
LIST_PREPEND(entries, list->entries, buf[j-1]);
|
||||
}
|
||||
|
||||
|
@ -321,24 +321,19 @@ int seat_switch_to_next(Seat *s) {
|
||||
}
|
||||
|
||||
int seat_switch_to_previous(Seat *s) {
|
||||
unsigned start, i;
|
||||
Session *session;
|
||||
|
||||
if (MALLOC_ELEMENTSOF(s->positions) == 0)
|
||||
return -EINVAL;
|
||||
|
||||
start = 1;
|
||||
if (s->active && s->active->position > 0)
|
||||
start = s->active->position;
|
||||
size_t start = s->active && s->active->position > 0 ? s->active->position : 1;
|
||||
|
||||
for (i = start - 1; i > 0; --i) {
|
||||
session = seat_get_position(s, i);
|
||||
for (size_t i = start - 1; i > 0; i--) {
|
||||
Session *session = seat_get_position(s, i);
|
||||
if (session)
|
||||
return session_activate(session);
|
||||
}
|
||||
|
||||
for (i = MALLOC_ELEMENTSOF(s->positions) - 1; i > start; --i) {
|
||||
session = seat_get_position(s, i);
|
||||
for (size_t i = MALLOC_ELEMENTSOF(s->positions) - 1; i > start; i--) {
|
||||
Session *session = seat_get_position(s, i);
|
||||
if (session)
|
||||
return session_activate(session);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user