[PATCH 2/3] Make some functions and global variables static

Pavel Roskin proski at gnu.org
Thu Aug 4 11:59:03 EDT 2011


---

 lib/cache.c             |    7 ++++---
 lib/msg.c               |    4 ++--
 lib/route/pktloc.c      |    2 +-
 lib/route/qdisc/netem.c |    3 ++-
 src/lib/tc.c            |    2 +-
 src/nl-addr-list.c      |    2 +-
 src/nl-class-delete.c   |    2 +-
 src/nl-class-list.c     |    4 ++--
 src/nl-cls-delete.c     |    2 +-
 src/nl-cls-list.c       |    4 ++--
 src/nl-neigh-delete.c   |    2 +-
 src/nl-qdisc-delete.c   |    2 +-
 12 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/lib/cache.c b/lib/cache.c
index 90c0c0f..a1c8eae 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -506,7 +506,8 @@ void nl_cache_set_arg2(struct nl_cache *cache, int arg)
  *
  * @return 0 on success or a negative error code.
  */
-int nl_cache_request_full_dump(struct nl_sock *sk, struct nl_cache *cache)
+static int nl_cache_request_full_dump(struct nl_sock *sk,
+				      struct nl_cache *cache)
 {
 	NL_DBG(2, "Requesting dump from kernel for cache %p <%s>...\n",
 	          cache, nl_cache_name(cache));
@@ -537,8 +538,8 @@ static int update_msg_parser(struct nl_msg *msg, void *arg)
  * @arg cache		Cache
  * @arg param		Parser parameters
  */
-int __cache_pickup(struct nl_sock *sk, struct nl_cache *cache,
-		   struct nl_parser_param *param)
+static int __cache_pickup(struct nl_sock *sk, struct nl_cache *cache,
+			  struct nl_parser_param *param)
 {
 	int err;
 	struct nl_cb *cb;
diff --git a/lib/msg.c b/lib/msg.c
index ee2922c..235ee82 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -188,7 +188,7 @@ int nlmsg_size(int payload)
 	return NLMSG_HDRLEN + payload;
 }
 
-int nlmsg_msg_size(int payload)
+static int nlmsg_msg_size(int payload)
 {
 	return nlmsg_size(payload);
 }
@@ -255,7 +255,7 @@ int nlmsg_datalen(const struct nlmsghdr *nlh)
 	return nlh->nlmsg_len - NLMSG_HDRLEN;
 }
 
-int nlmsg_len(const struct nlmsghdr *nlh)
+static int nlmsg_len(const struct nlmsghdr *nlh)
 {
 	return nlmsg_datalen(nlh);
 }
diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c
index b677ab5..c658e67 100644
--- a/lib/route/pktloc.c
+++ b/lib/route/pktloc.c
@@ -45,7 +45,7 @@
 static struct nl_list_head pktloc_name_ht[PKTLOC_NAME_HT_SIZ];
 
 /* djb2 */
-unsigned int pktloc_hash(const char *str)
+static unsigned int pktloc_hash(const char *str)
 {
 	unsigned long hash = 5381;
 	int c;
diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c
index c86af56..997a31f 100644
--- a/lib/route/qdisc/netem.c
+++ b/lib/route/qdisc/netem.c
@@ -145,7 +145,8 @@ static void netem_dump_line(struct rtnl_tc *tc, void *data,
 		nl_dump(p, "limit %d", netem->qnm_limit);
 }
 
-int netem_msg_fill_raw(struct rtnl_tc *tc, void *data, struct nl_msg *msg)
+static int netem_msg_fill_raw(struct rtnl_tc *tc, void *data,
+			      struct nl_msg *msg)
 {
 	int err = 0;
 	struct tc_netem_qopt opts;
diff --git a/src/lib/tc.c b/src/lib/tc.c
index 4cdd081..26124f1 100644
--- a/src/lib/tc.c
+++ b/src/lib/tc.c
@@ -94,7 +94,7 @@ void nl_cli_tc_parse_linktype(struct rtnl_tc *tc, char *arg)
 
 static NL_LIST_HEAD(tc_modules);
 
-struct nl_cli_tc_module *__nl_cli_tc_lookup(struct rtnl_tc_ops *ops)
+static struct nl_cli_tc_module *__nl_cli_tc_lookup(struct rtnl_tc_ops *ops)
 {
 	struct nl_cli_tc_module *tm;
 
diff --git a/src/nl-addr-list.c b/src/nl-addr-list.c
index 9b045a5..5044d5c 100644
--- a/src/nl-addr-list.c
+++ b/src/nl-addr-list.c
@@ -41,7 +41,7 @@ static void print_usage(void)
 
 static char *prefix;
 
-void print_prefix(struct nl_dump_params *p, int line)
+static void print_prefix(struct nl_dump_params *p, int line)
 {
 	if (prefix)
 		nl_dump(p, "%s", prefix);
diff --git a/src/nl-class-delete.c b/src/nl-class-delete.c
index 3df5a9a..37657a4 100644
--- a/src/nl-class-delete.c
+++ b/src/nl-class-delete.c
@@ -14,7 +14,7 @@
 #include <netlink/cli/link.h>
 
 static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0;
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
 static void print_usage(void)
 {
diff --git a/src/nl-class-list.c b/src/nl-class-list.c
index 44ca49b..c2423fb 100644
--- a/src/nl-class-list.c
+++ b/src/nl-class-list.c
@@ -14,9 +14,9 @@
 #include <netlink/cli/class.h>
 #include <netlink/cli/link.h>
 
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
-struct nl_dump_params params = {
+static struct nl_dump_params params = {
 	.dp_type = NL_DUMP_LINE,
 };
 
diff --git a/src/nl-cls-delete.c b/src/nl-cls-delete.c
index 7d998fd..2b3db1f 100644
--- a/src/nl-cls-delete.c
+++ b/src/nl-cls-delete.c
@@ -14,7 +14,7 @@
 #include <netlink/cli/link.h>
 
 static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0;
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
 static void print_usage(void)
 {
diff --git a/src/nl-cls-list.c b/src/nl-cls-list.c
index fcb5dcb..5072585 100644
--- a/src/nl-cls-list.c
+++ b/src/nl-cls-list.c
@@ -14,9 +14,9 @@
 #include <netlink/cli/cls.h>
 #include <netlink/cli/link.h>
 
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
-struct nl_dump_params params = {
+static struct nl_dump_params params = {
 	.dp_type = NL_DUMP_LINE,
 };
 
diff --git a/src/nl-neigh-delete.c b/src/nl-neigh-delete.c
index 887bd84..c418608 100644
--- a/src/nl-neigh-delete.c
+++ b/src/nl-neigh-delete.c
@@ -14,7 +14,7 @@
 #include <netlink/cli/link.h>
 
 static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0;
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
 static void print_usage(void)
 {
diff --git a/src/nl-qdisc-delete.c b/src/nl-qdisc-delete.c
index 9c7ec14..2f945bb 100644
--- a/src/nl-qdisc-delete.c
+++ b/src/nl-qdisc-delete.c
@@ -15,7 +15,7 @@
 #include <netlink/cli/link.h>
 
 static int quiet = 0, default_yes = 0, deleted = 0, interactive = 0;
-struct nl_sock *sock;
+static struct nl_sock *sock;
 
 static void print_usage(void)
 {



More information about the libnl mailing list