From 533f8a677113b8532bcda422f881709f083db897 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 23 Dec 2017 19:16:49 +0900 Subject: [PATCH] load-fragment: simplify list insertion logic LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list. --- src/core/load-fragment.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index e1e8333c8d2..f9c2acc53a9 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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; -- 2.47.3