load-fragment: simplify list insertion logic

LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list.
This commit is contained in:
Yu Watanabe
2017-12-23 19:16:49 +09:00
parent 32048f5414
commit 533f8a6771

View File

@@ -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;