mirror of
https://github.com/systemd/systemd.git
synced 2026-07-20 14:30:45 +00:00
load-fragment: simplify list insertion logic
LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list.
This commit is contained in:
@@ -434,11 +434,9 @@ int config_parse_socket_listen(const char *unit,
|
||||
p->n_auxiliary_fds = 0;
|
||||
p->socket = s;
|
||||
|
||||
if (s->ports) {
|
||||
LIST_FIND_TAIL(port, s->ports, tail);
|
||||
LIST_INSERT_AFTER(port, s->ports, tail, p);
|
||||
} else
|
||||
LIST_PREPEND(port, s->ports, p);
|
||||
LIST_FIND_TAIL(port, s->ports, tail);
|
||||
LIST_INSERT_AFTER(port, s->ports, tail, p);
|
||||
|
||||
p = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user