wg: avoid unneccessary next_peer assignments in sort_peers()
Signed-off-by: Luis Ressel <aranea@aixah.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
cdb687cc0b
commit
4471ee711c
|
@ -60,11 +60,10 @@ static void sort_peers(struct wgdevice *device)
|
||||||
peers[i++] = peer;
|
peers[i++] = peer;
|
||||||
qsort(peers, peer_count, sizeof(*peers), peer_cmp);
|
qsort(peers, peer_count, sizeof(*peers), peer_cmp);
|
||||||
device->first_peer = peers[0];
|
device->first_peer = peers[0];
|
||||||
peers[0]->next_peer = NULL;
|
|
||||||
for (i = 1; i < peer_count; ++i) {
|
for (i = 1; i < peer_count; ++i) {
|
||||||
peers[i - 1]->next_peer = peers[i];
|
peers[i - 1]->next_peer = peers[i];
|
||||||
peers[i]->next_peer = NULL;
|
|
||||||
}
|
}
|
||||||
|
peers[peer_count - 1]->next_peer = NULL;
|
||||||
free(peers);
|
free(peers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue