From 07630cea1f3a845c09309f197ac7c4f11edd3b62 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 24 Oct 2015 22:58:24 +0200 Subject: util-lib: split our string related calls from util.[ch] into its own file string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files. --- src/network/networkctl.c | 1 + src/network/networkd-address-pool.c | 3 ++- src/network/networkd-address.c | 4 ++-- src/network/networkd-dhcp6.c | 6 +++--- src/network/networkd-link.h | 4 ++-- src/network/networkd-manager.c | 17 ++++++++--------- src/network/networkd-ndisc.c | 4 ++-- src/network/networkd-netdev-bond.c | 6 ++++-- src/network/networkd-netdev-tunnel.c | 8 +++++--- src/network/networkd-netdev.c | 4 ++-- src/network/networkd-network-bus.c | 4 ++-- src/network/networkd-network.c | 6 +++--- src/network/networkd-route.c | 4 ++-- src/network/networkd-util.c | 4 ++-- src/network/networkd-wait-online-link.c | 2 +- 15 files changed, 41 insertions(+), 36 deletions(-) (limited to 'src/network') diff --git a/src/network/networkctl.c b/src/network/networkctl.c index c78b9444b6..acb6b7ce24 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -37,6 +37,7 @@ #include "netlink-util.h" #include "pager.h" #include "socket-util.h" +#include "string-util.h" #include "strv.h" #include "terminal-util.h" #include "util.h" diff --git a/src/network/networkd-address-pool.c b/src/network/networkd-address-pool.c index b3450c1456..08e0b9a64b 100644 --- a/src/network/networkd-address-pool.c +++ b/src/network/networkd-address-pool.c @@ -19,9 +19,10 @@ along with systemd; If not, see . ***/ -#include "networkd.h" #include "networkd-address-pool.h" +#include "networkd.h" #include "set.h" +#include "string-util.h" int address_pool_new( Manager *m, diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 5d443e9b9b..dcd7b482d3 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -24,11 +24,11 @@ #include "conf-parser.h" #include "firewall-util.h" #include "netlink-util.h" +#include "networkd.h" #include "set.h" +#include "string-util.h" #include "utf8.h" #include "util.h" - -#include "networkd.h" #include "networkd-address.h" int address_new(Address **ret) { diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 57c81cb646..623359def6 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -22,11 +22,11 @@ #include #include -#include "networkd-link.h" -#include "network-internal.h" - #include "sd-dhcp6-client.h" +#include "network-internal.h" +#include "networkd-link.h" + static int dhcp6_lease_address_acquired(sd_dhcp6_client *client, Link *link); static int dhcp6_lease_information_acquired(sd_dhcp6_client *client, diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h index 5c92df4ca8..2a69f1c16b 100644 --- a/src/network/networkd-link.h +++ b/src/network/networkd-link.h @@ -25,10 +25,10 @@ #include "sd-dhcp-client.h" #include "sd-dhcp-server.h" -#include "sd-ipv4ll.h" -#include "sd-ndisc.h" #include "sd-dhcp6-client.h" +#include "sd-ipv4ll.h" #include "sd-lldp.h" +#include "sd-ndisc.h" typedef struct Link Link; diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index e0e1679ede..23d3aac694 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -22,21 +22,20 @@ #include #include -#include "sd-netlink.h" #include "sd-daemon.h" +#include "sd-netlink.h" -#include "conf-parser.h" -#include "path-util.h" -#include "libudev-private.h" -#include "udev-util.h" -#include "netlink-util.h" #include "bus-util.h" +#include "conf-parser.h" #include "def.h" -#include "virt.h" -#include "set.h" +#include "libudev-private.h" #include "local-addresses.h" - +#include "netlink-util.h" #include "networkd.h" +#include "path-util.h" +#include "set.h" +#include "udev-util.h" +#include "virt.h" /* use 8 MB for receive socket kernel queue. */ #define RCVBUF_SIZE (8*1024*1024) diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 637c29973e..33e692f97f 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -22,10 +22,10 @@ #include #include -#include "networkd-link.h" - #include "sd-ndisc.h" +#include "networkd-link.h" + static void ndisc_router_handler(sd_ndisc *nd, int event, void *userdata) { Link *link = userdata; diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c index bcaba57937..f66c88c35e 100644 --- a/src/network/networkd-netdev-bond.c +++ b/src/network/networkd-netdev-bond.c @@ -23,10 +23,12 @@ #include #include -#include "conf-parser.h" #include "sd-netlink.h" -#include "networkd-netdev-bond.h" + +#include "conf-parser.h" #include "missing.h" +#include "string-util.h" +#include "networkd-netdev-bond.h" /* * Number of seconds between instances where the bonding diff --git a/src/network/networkd-netdev-tunnel.c b/src/network/networkd-netdev-tunnel.c index c9b7fa96e2..bbc4606258 100644 --- a/src/network/networkd-netdev-tunnel.c +++ b/src/network/networkd-netdev-tunnel.c @@ -26,11 +26,13 @@ #include #include "sd-netlink.h" -#include "networkd-netdev-tunnel.h" + +#include "conf-parser.h" +#include "missing.h" #include "networkd-link.h" +#include "string-util.h" #include "util.h" -#include "missing.h" -#include "conf-parser.h" +#include "networkd-netdev-tunnel.h" #define DEFAULT_TNL_HOP_LIMIT 64 #define IP6_FLOWINFO_FLOWLABEL htonl(0x000FFFFF) diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index 3d4865a780..d9ccc19d3d 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -24,11 +24,11 @@ #include "conf-files.h" #include "conf-parser.h" #include "list.h" -#include "siphash24.h" #include "netlink-util.h" #include "network-internal.h" - #include "networkd.h" +#include "siphash24.h" +#include "string-util.h" #include "networkd-netdev.h" const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX] = { diff --git a/src/network/networkd-network-bus.c b/src/network/networkd-network-bus.c index 5717a15327..2199b93baa 100644 --- a/src/network/networkd-network-bus.c +++ b/src/network/networkd-network-bus.c @@ -19,9 +19,9 @@ along with systemd; If not, see . ***/ -#include "strv.h" - #include "networkd.h" +#include "string-util.h" +#include "strv.h" static int property_get_ether_addrs( sd_bus *bus, diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 97ada56866..9f9a6911e3 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -24,12 +24,12 @@ #include "conf-files.h" #include "conf-parser.h" -#include "util.h" -#include "hostname-util.h" #include "dns-domain.h" +#include "hostname-util.h" #include "network-internal.h" - #include "networkd.h" +#include "string-util.h" +#include "util.h" #include "networkd-network.h" static int network_load_one(Manager *manager, const char *filename) { diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index aa4ec230ab..fcca679093 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -22,9 +22,9 @@ #include "conf-parser.h" #include "in-addr-util.h" #include "netlink-util.h" -#include "util.h" - #include "networkd.h" +#include "string-util.h" +#include "util.h" #include "networkd-route.h" int route_new(Route **ret) { diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index dde6b327ed..4e4a4bbd58 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -19,10 +19,10 @@ along with systemd; If not, see . ***/ -#include "util.h" #include "conf-parser.h" - #include "networkd-util.h" +#include "string-util.h" +#include "util.h" const char *address_family_boolean_to_string(AddressFamilyBoolean b) { if (b == ADDRESS_FAMILY_YES || diff --git a/src/network/networkd-wait-online-link.c b/src/network/networkd-wait-online-link.c index cacb4c257e..cc4b46d5b0 100644 --- a/src/network/networkd-wait-online-link.c +++ b/src/network/networkd-wait-online-link.c @@ -20,10 +20,10 @@ along with systemd; If not, see . ***/ - #include "sd-network.h" #include "networkd-wait-online-link.h" +#include "string-util.h" int link_new(Manager *m, Link **ret, int ifindex, const char *ifname) { _cleanup_(link_freep) Link *l = NULL; -- cgit v1.2.3-54-g00ecf