]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
load-fragment: simplify list insertion logic 7695/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 23 Dec 2017 10:16:49 +0000 (19:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 23 Dec 2017 10:32:46 +0000 (19:32 +0900)
LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list.

src/core/load-fragment.c

index e1e8333c8d2f23cdf3712d8b7fe7cc535f263811..f9c2acc53a9168e611778d16671790e78e3243f8 100644 (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;