naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone
Blob Blame History Raw
From c1bb5cac86c0665c596d3fc9057c536e136675e2 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Wed, 1 Feb 2017 14:19:26 +0100
Subject: [PATCH] remove unnecessary extern

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1329730
Upstream Status: iproute2.git commit 892e21248cfdb
Conflicts: Parts applied manually due to multiple context changes.

commit 892e21248cfdb8c1332d46a01df253eae748c9d8
Author: Stephen Hemminger <shemming@brocade.com>
Date:   Thu Aug 13 14:09:58 2015 -0700

    remove unnecessary extern

    No need for extern on function prototypes.
---
 include/dlfcn.h      |  2 +-
 include/libnetlink.h | 78 +++++++++++++++++++++++++++-------------------------
 include/ll_map.h     | 18 ++++++------
 include/namespace.h  |  6 ++--
 include/utils.h      | 56 ++++++++++++++++++-------------------
 5 files changed, 82 insertions(+), 78 deletions(-)

diff --git a/include/dlfcn.h b/include/dlfcn.h
index c54f8d8..f15bc2c 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -19,7 +19,7 @@ static inline void *dlopen(const char *file, int flag)
 		return NULL;
 }
 
-extern void *_dlsym(const char *sym);
+void *_dlsym(const char *sym);
 static inline void *dlsym(void *handle, const char *sym)
 {
 	if (handle != _FAKE_DLFCN_HDL)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 8c90873..40fa6ff 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -26,20 +26,20 @@ struct rtnl_handle
 
 extern int rcvbuf;
 
-extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions)
+int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions)
 	__attribute__((warn_unused_result));
 
-extern int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions,
+int rtnl_open_byproto(struct rtnl_handle *rth, unsigned subscriptions,
 			     int protocol)
 	__attribute__((warn_unused_result));
 
-extern void rtnl_close(struct rtnl_handle *rth);
-extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
+void rtnl_close(struct rtnl_handle *rth);
+int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type)
 	__attribute__((warn_unused_result));
-extern int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
+int rtnl_wilddump_req_filter(struct rtnl_handle *rth, int fam, int type,
 				    __u32 filt_mask)
 	__attribute__((warn_unused_result));
-extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
+int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req,
 			     int len)
 	__attribute__((warn_unused_result));
 
@@ -61,43 +61,47 @@ struct rtnl_dump_filter_arg
 	__u16 nc_flags;
 };
 
-extern int rtnl_dump_filter_l(struct rtnl_handle *rth,
+int rtnl_dump_filter_l(struct rtnl_handle *rth,
 			      const struct rtnl_dump_filter_arg *arg);
 int rtnl_dump_filter_nc(struct rtnl_handle *rth,
 			rtnl_filter_t filter,
 			void *arg, __u16 nc_flags);
 #define rtnl_dump_filter(rth, filter, arg) \
 	rtnl_dump_filter_nc(rth, filter, arg, 0)
-extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
-		     struct nlmsghdr *answer, size_t len)
+int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
+	      struct nlmsghdr *answer, size_t len)
 	__attribute__((warn_unused_result));
-extern int rtnl_send(struct rtnl_handle *rth, const void *buf, int)
+int rtnl_send(struct rtnl_handle *rth, const void *buf, int)
 	__attribute__((warn_unused_result));
-extern int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int)
+int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int)
 	__attribute__((warn_unused_result));
 
-extern int addattr(struct nlmsghdr *n, int maxlen, int type);
-extern int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data);
-extern int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data);
-extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
-extern int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data);
-extern int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data);
-
-extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen);
-extern int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len);
-extern struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
-extern int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
-extern struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type, const void *data, int len);
-extern int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest);
-extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
-extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, const void *data, int alen);
-
-extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
-extern int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
+int addattr(struct nlmsghdr *n, int maxlen, int type);
+int addattr8(struct nlmsghdr *n, int maxlen, int type, __u8 data);
+int addattr16(struct nlmsghdr *n, int maxlen, int type, __u16 data);
+int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
+int addattr64(struct nlmsghdr *n, int maxlen, int type, __u64 data);
+int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *data);
+
+int addattr_l(struct nlmsghdr *n, int maxlen, int type,
+	      const void *data, int alen);
+int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len);
+struct rtattr *addattr_nest(struct nlmsghdr *n, int maxlen, int type);
+int addattr_nest_end(struct nlmsghdr *n, struct rtattr *nest);
+struct rtattr *addattr_nest_compat(struct nlmsghdr *n, int maxlen, int type,
+				   const void *data, int len);
+int addattr_nest_compat_end(struct nlmsghdr *n, struct rtattr *nest);
+int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
+int rta_addattr_l(struct rtattr *rta, int maxlen, int type,
+		  const void *data, int alen);
+
+int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
+int parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
 			      int len, unsigned short flags);
-extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta, int len);
-extern struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len);
-extern int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
+int parse_rtattr_byindex(struct rtattr *tb[], int max,
+			 struct rtattr *rta, int len);
+struct rtattr *parse_rtattr_one(int type, struct rtattr *rta, int len);
+int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rta, int len);
 
 #define parse_rtattr_nested(tb, max, rta) \
 	(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
@@ -132,11 +136,11 @@ static inline const char *rta_getattr_str(const struct rtattr *rta)
 	return (const char *)RTA_DATA(rta);
 }
 
-extern int rtnl_listen_all_nsid(struct rtnl_handle *);
-extern int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler,
-		       void *jarg);
-extern int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
-		       void *jarg);
+int rtnl_listen_all_nsid(struct rtnl_handle *);
+int rtnl_listen(struct rtnl_handle *, rtnl_listen_filter_t handler,
+		void *jarg);
+int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
+		   void *jarg);
 
 #define NLMSG_TAIL(nmsg) \
 	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
diff --git a/include/ll_map.h b/include/ll_map.h
index b98a571..949bfc3 100644
--- a/include/ll_map.h
+++ b/include/ll_map.h
@@ -1,15 +1,15 @@
 #ifndef __LL_MAP_H__
 #define __LL_MAP_H__ 1
 
-extern int ll_remember_index(const struct sockaddr_nl *who,
-			     struct nlmsghdr *n, void *arg);
+int ll_remember_index(const struct sockaddr_nl *who,
+		      struct nlmsghdr *n, void *arg);
 
-extern void ll_init_map(struct rtnl_handle *rth);
-extern unsigned ll_name_to_index(const char *name);
-extern const char *ll_index_to_name(unsigned idx);
-extern const char *ll_idx_n2a(unsigned idx, char *buf);
-extern int ll_index_to_type(unsigned idx);
-extern int ll_index_to_flags(unsigned idx);
-extern unsigned namehash(const char *str);
+void ll_init_map(struct rtnl_handle *rth);
+unsigned ll_name_to_index(const char *name);
+const char *ll_index_to_name(unsigned idx);
+const char *ll_idx_n2a(unsigned idx, char *buf);
+int ll_index_to_type(unsigned idx);
+int ll_index_to_flags(unsigned idx);
+unsigned namehash(const char *str);
 
 #endif /* __LL_MAP_H__ */
diff --git a/include/namespace.h b/include/namespace.h
index 5add9d2..51324b2 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -43,9 +43,9 @@ static inline int setns(int fd, int nstype)
 }
 #endif /* HAVE_SETNS */
 
-extern int netns_switch(char *netns);
-extern int netns_get_fd(const char *netns);
-extern int netns_foreach(int (*func)(char *nsname, void *arg), void *arg);
+int netns_switch(char *netns);
+int netns_get_fd(const char *netns);
+int netns_foreach(int (*func)(char *nsname, void *arg), void *arg);
 
 struct netns_func {
 	int (*func)(char *nsname, void *arg);
diff --git a/include/utils.h b/include/utils.h
index 2d1e390..a1f9eb3 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -42,7 +42,7 @@ extern bool do_all;
 #define SPRINT_BSIZE 64
 #define SPRINT_BUF(x)	char x[SPRINT_BSIZE]
 
-extern void incomplete_command(void) __attribute__((noreturn));
+void incomplete_command(void) __attribute__((noreturn));
 
 #define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0)
 #define NEXT_ARG_OK() (argc - 1 > 0)
@@ -77,27 +77,27 @@ struct ipx_addr {
 	u_int8_t  ipx_node[IPX_NODE_LEN];
 };
 
-extern __u32 get_addr32(const char *name);
-extern int get_addr_1(inet_prefix *dst, const char *arg, int family);
-extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
-extern int get_addr(inet_prefix *dst, const char *arg, int family);
-extern int get_prefix(inet_prefix *dst, char *arg, int family);
-extern int mask2bits(__u32 netmask);
+__u32 get_addr32(const char *name);
+int get_addr_1(inet_prefix *dst, const char *arg, int family);
+int get_prefix_1(inet_prefix *dst, char *arg, int family);
+int get_addr(inet_prefix *dst, const char *arg, int family);
+int get_prefix(inet_prefix *dst, char *arg, int family);
+int mask2bits(__u32 netmask);
 
 int get_hex(char c);
-extern int get_integer(int *val, const char *arg, int base);
-extern int get_unsigned(unsigned *val, const char *arg, int base);
-extern int get_time_rtt(unsigned *val, const char *arg, int *raw);
+int get_integer(int *val, const char *arg, int base);
+int get_unsigned(unsigned *val, const char *arg, int base);
+int get_time_rtt(unsigned *val, const char *arg, int *raw);
 #define get_byte get_u8
 #define get_ushort get_u16
 #define get_short get_s16
-extern int get_u64(__u64 *val, const char *arg, int base);
-extern int get_u32(__u32 *val, const char *arg, int base);
-extern int get_s32(__s32 *val, const char *arg, int base);
-extern int get_u16(__u16 *val, const char *arg, int base);
-extern int get_s16(__s16 *val, const char *arg, int base);
-extern int get_u8(__u8 *val, const char *arg, int base);
-extern int get_s8(__s8 *val, const char *arg, int base);
+int get_u64(__u64 *val, const char *arg, int base);
+int get_u32(__u32 *val, const char *arg, int base);
+int get_s32(__s32 *val, const char *arg, int base);
+int get_u16(__u16 *val, const char *arg, int base);
+int get_s16(__s16 *val, const char *arg, int base);
+int get_u8(__u8 *val, const char *arg, int base);
+int get_s8(__s8 *val, const char *arg, int base);
 int get_be64(__be64 *val, const char *arg, int base);
 int get_be32(__be32 *val, const char *arg, int base);
 int get_be16(__be16 *val, const char *arg, int base);
@@ -105,20 +105,20 @@ int get_be16(__be16 *val, const char *arg, int base);
 char *hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
 __u8 *hexstring_a2n(const char *str, __u8 *buf, int blen, unsigned int *len);
 
-extern const char *format_host(int af, int len, const void *addr,
+const char *format_host(int af, int len, const void *addr,
 			       char *buf, int buflen);
-extern const char *rt_addr_n2a(int af, int len, const void *addr,
+const char *rt_addr_n2a(int af, int len, const void *addr,
 			       char *buf, int buflen);
 
-extern int read_family(const char *name);
-extern const char *family_name(int family);
+int read_family(const char *name);
+const char *family_name(int family);
 
 void missarg(const char *) __attribute__((noreturn));
 void invarg(const char *, const char *) __attribute__((noreturn));
 void duparg(const char *, const char *) __attribute__((noreturn));
 void duparg2(const char *, const char *) __attribute__((noreturn));
 int matches(const char *arg, const char *pattern);
-extern int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
+int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
 
 const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
 int dnet_pton(int af, const char *src, void *addr);
@@ -127,7 +127,7 @@ const char *ipx_ntop(int af, const void *addr, char *str, size_t len);
 int ipx_pton(int af, const char *src, void *addr);
 
 extern int __iproute2_hz_internal;
-extern int __get_hz(void);
+__get_hz(void);
 
 static __inline__ int get_hz(void)
 {
@@ -137,7 +137,7 @@ static __inline__ int get_hz(void)
 }
 
 extern int __iproute2_user_hz_internal;
-extern int __get_user_hz(void);
+int __get_user_hz(void);
 
 static __inline__ int get_user_hz(void)
 {
@@ -164,16 +164,16 @@ int print_timestamp(FILE *fp);
 #define ntohll(x) ((1==ntohl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))
 
 extern int cmdlineno;
-extern ssize_t getcmdline(char **line, size_t *len, FILE *in);
-extern int makeargs(char *line, char *argv[], int maxargs);
-extern int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
+ssize_t getcmdline(char **line, size_t *len, FILE *in);
+int makeargs(char *line, char *argv[], int maxargs);
+int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
 
 struct iplink_req;
 int iplink_parse(int argc, char **argv, struct iplink_req *req,
 		char **name, char **type, char **link, char **dev,
 		int *group);
 
-extern int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
+int do_each_netns(int (*func)(char *nsname, void *arg), void *arg,
 		bool show_label);
 
 char *int_to_str(int val, char *buf);
-- 
1.8.3.1