mirror of
https://github.com/systemd/systemd.git
synced 2025-01-06 17:18:12 +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 {
|
else {
|
||||||
_cleanup_free_ struct udev_list_entry **buf = NULL;
|
_cleanup_free_ struct udev_list_entry **buf = NULL;
|
||||||
struct udev_list_entry *entry, **p;
|
struct udev_list_entry *entry, **p;
|
||||||
size_t j;
|
|
||||||
|
|
||||||
buf = new(struct udev_list_entry *, n);
|
buf = new(struct udev_list_entry *, n);
|
||||||
if (!buf)
|
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);
|
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]);
|
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) {
|
int seat_switch_to_previous(Seat *s) {
|
||||||
unsigned start, i;
|
|
||||||
Session *session;
|
|
||||||
|
|
||||||
if (MALLOC_ELEMENTSOF(s->positions) == 0)
|
if (MALLOC_ELEMENTSOF(s->positions) == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
start = 1;
|
size_t start = s->active && s->active->position > 0 ? s->active->position : 1;
|
||||||
if (s->active && s->active->position > 0)
|
|
||||||
start = s->active->position;
|
|
||||||
|
|
||||||
for (i = start - 1; i > 0; --i) {
|
for (size_t i = start - 1; i > 0; i--) {
|
||||||
session = seat_get_position(s, i);
|
Session *session = seat_get_position(s, i);
|
||||||
if (session)
|
if (session)
|
||||||
return session_activate(session);
|
return session_activate(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = MALLOC_ELEMENTSOF(s->positions) - 1; i > start; --i) {
|
for (size_t i = MALLOC_ELEMENTSOF(s->positions) - 1; i > start; i--) {
|
||||||
session = seat_get_position(s, i);
|
Session *session = seat_get_position(s, i);
|
||||||
if (session)
|
if (session)
|
||||||
return session_activate(session);
|
return session_activate(session);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user