Include bsd/string.h only in include/utils.h
Subsystems (3)
PATCH 1/1 Include bsd/string.h only in include/utils.h
This is simpler and cleaner, and avoids having to include the header from every file where the functions are used. The prototypes of the internal implementation are in this header, so utils.h will have to be included anyway for those.
Fixes 508f3c231efb ("Use libbsd for strlcpy if available")
Signed-off-by Luca Boccassi <[email protected]>
--- genl/ctrl.c | 3 --- include/utils.h | 4 ++++ ip/iplink.c | 3 --- ip/ipnetns.c | 3 --- ip/iproute_lwtunnel.c | 3 --- ip/ipvrf.c | 3 --- ip/ipxfrm.c | 3 --- ip/tunnel.c | 3 --- ip/xfrm_state.c | 3 --- lib/bpf.c | 3 --- lib/fs.c | 3 --- lib/inet_proto.c | 3 --- misc/ss.c | 3 --- tc/em_ipset.c | 3 --- tc/m_pedit.c | 3 --- 15 files changed, 4 insertions(+), 42 deletions(-)
genl/ctrl.c +0 -3
@@ -18,9 +18,6 @@#include <netinet/in.h> #include <arpa/inet.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include "utils.h" #include "genl_utils.h"
include/utils.h +4 -0
@@ -9,6 +9,10 @@#include <stdbool.h> #include <time.h> +#ifdef HAVE_LIBBSD +#include <bsd/string.h> +#endif +#include "libnetlink.h" #include "ll_map.h" #include "rtm_map.h"
ip/iplink.c +0 -3
@@ -24,9 +24,6 @@#include <netinet/in.h> #include <arpa/inet.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <sys/ioctl.h> #include <stdbool.h> #include <linux/mpls.h>
ip/ipnetns.c +0 -3
@@ -8,9 +8,6 @@#include <sys/syscall.h> #include <stdio.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <sched.h> #include <fcntl.h> #include <dirent.h>
ip/iproute_lwtunnel.c +0 -3
@@ -16,9 +16,6 @@#include <unistd.h> #include <fcntl.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <linux/ila.h> #include <linux/lwtunnel.h> #include <linux/mpls_iptunnel.h>
ip/ipvrf.c +0 -3
@@ -21,9 +21,6 @@#include <stdlib.h> #include <unistd.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <dirent.h> #include <errno.h> #include <limits.h>
ip/ipxfrm.c +0 -3
@@ -28,9 +28,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <sys/types.h> #include <sys/socket.h> #include <time.h>
ip/tunnel.c +0 -3
@@ -24,9 +24,6 @@#include <stdio.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <unistd.h> #include <errno.h> #include <sys/types.h>
ip/xfrm_state.c +0 -3
@@ -27,9 +27,6 @@#include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <netdb.h> #include "utils.h" #include "xfrm.h"
lib/bpf.c +0 -3
@@ -15,9 +15,6 @@#include <stdlib.h> #include <unistd.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <stdbool.h> #include <stdint.h> #include <errno.h>
lib/fs.c +0 -3
@@ -20,9 +20,6 @@#include <stdlib.h> #include <unistd.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <errno.h> #include <limits.h>
lib/inet_proto.c +0 -3
@@ -18,9 +18,6 @@#include <netinet/in.h> #include <netdb.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include "rt_names.h" #include "utils.h"
misc/ss.c +0 -3
@@ -19,9 +19,6 @@#include <sys/sysmacros.h> #include <netinet/in.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <errno.h> #include <netdb.h> #include <arpa/inet.h>
tc/em_ipset.c +0 -3
@@ -20,9 +20,6 @@#include <netdb.h> #include <unistd.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <stdlib.h> #include <getopt.h>
tc/m_pedit.c +0 -3
@@ -23,9 +23,6 @@#include <netinet/in.h> #include <arpa/inet.h> #include <string.h> -#ifdef HAVE_LIBBSD -#include <bsd/string.h> -#endif #include <dlfcn.h> #include "utils.h" #include "tc_util.h"
Signature · 1 line
2.19.1
Quoted 8 lines · On Thu, 1 Nov 2018 22:25:27 +0000 Luca Boccassi <[email protected]> wrote:
This is simpler and cleaner, and avoids having to include the header from every file where the functions are used. The prototypes of the internal implementation are in this header, so
utils.hwill have to be included anyway for those.Fixes 508f3c231efb ("Use libbsd for strlcpy if available")Signed-off-by Luca Boccassi <[email protected]>
Looks better. Applied