diff mbox series

[iproute2] Include bsd/string.h only in include/utils.h

Message ID 20181101222527.29439-1-bluca@debian.org
State Accepted, archived
Delegated to: stephen hemminger
Headers show
Series [iproute2] Include bsd/string.h only in include/utils.h | expand

Commit Message

Luca Boccassi Nov. 1, 2018, 10:25 p.m. UTC
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 <bluca@debian.org>
---
 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(-)

Comments

Stephen Hemminger Nov. 5, 2018, 4:39 p.m. UTC | #1
On Thu,  1 Nov 2018 22:25:27 +0000
Luca Boccassi <bluca@debian.org> 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.h will have to be
> included anyway for those.
> 
> Fixes: 508f3c231efb ("Use libbsd for strlcpy if available")
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>

Looks better. Applied
diff mbox series

Patch

diff --git a/genl/ctrl.c b/genl/ctrl.c
index fef6aaa9..6133336a 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -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"
diff --git a/include/utils.h b/include/utils.h
index 685d2c1d..bf6dea23 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -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"
diff --git a/ip/iplink.c b/ip/iplink.c
index 067f5409..b5519201 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -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>
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index da019d76..0eac18cf 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -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>
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 2285bc1d..8f497015 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -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>
diff --git a/ip/ipvrf.c b/ip/ipvrf.c
index 8572b4f2..8a6b7f97 100644
--- a/ip/ipvrf.c
+++ b/ip/ipvrf.c
@@ -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>
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index b02f30a6..17ab4abe 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -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>
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 73abb2e2..d0d55f37 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -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>
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 18e0c6fa..e8c01746 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -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"
diff --git a/lib/bpf.c b/lib/bpf.c
index 35d7c45a..45f279fa 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -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>
diff --git a/lib/fs.c b/lib/fs.c
index af36bea0..86efd4ed 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -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>
 
diff --git a/lib/inet_proto.c b/lib/inet_proto.c
index b379d8f8..0836a4c9 100644
--- a/lib/inet_proto.c
+++ b/lib/inet_proto.c
@@ -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"
diff --git a/misc/ss.c b/misc/ss.c
index c472fbd9..4d12fb5d 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -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>
diff --git a/tc/em_ipset.c b/tc/em_ipset.c
index 550b2101..48b287f5 100644
--- a/tc/em_ipset.c
+++ b/tc/em_ipset.c
@@ -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>
 
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index baacc80d..2aeb56d9 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -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"