]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: make some variables static
authorDavid Lamparter <equinox@diac24.net>
Wed, 27 Nov 2019 20:17:57 +0000 (21:17 +0100)
committerDavid Lamparter <equinox@diac24.net>
Fri, 13 Dec 2019 05:22:34 +0000 (06:22 +0100)
Signed-off-by: David Lamparter <equinox@diac24.net>
13 files changed:
lib/agg_table.c
lib/command_lex.l
lib/if.c
lib/netns_linux.c
lib/netns_other.c
lib/nexthop_group.c
lib/ns.h
lib/routemap.c
lib/systemd.c
lib/vrf.c
lib/vty.c
lib/yang.c
lib/yang.h

index dad6a13d674a6c445be069d0be6d9cb5b54173dc..22b981e28433be7aaff9250225514e0b0526bb3f 100644 (file)
@@ -41,7 +41,7 @@ static void agg_node_destroy(route_table_delegate_t *delegate,
        XFREE(MTYPE_TMP, anode);
 }
 
-route_table_delegate_t agg_table_delegate = {
+static route_table_delegate_t agg_table_delegate = {
        .create_node = agg_node_create,
        .destroy_node = agg_node_destroy,
 };
index f361db78e940d3ea0657b5dd1c4a103543109f48..0556605d637cd5d731b1a692db1b2e1ae99c1e01 100644 (file)
@@ -85,7 +85,7 @@ RANGE           \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
 .               {return yytext[0];}
 %%
 
-YY_BUFFER_STATE buffer;
+static YY_BUFFER_STATE buffer;
 
 void set_lexer_string (yyscan_t *scn, const char *string)
 {
index 31c1d9e8ba959d73750675397fbcab62f0d64c5e..c91407084e039561de6d167a100e6a178d80cba1 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -58,7 +58,7 @@ DEFINE_QOBJ_TYPE(interface)
 DEFINE_HOOK(if_add, (struct interface * ifp), (ifp))
 DEFINE_KOOH(if_del, (struct interface * ifp), (ifp))
 
-struct interface_master{
+static struct interface_master{
        int (*create_hook)(struct interface *ifp);
        int (*up_hook)(struct interface *ifp);
        int (*down_hook)(struct interface *ifp);
index 55c66fdc3df2374108b317cba4d04195c1fd4920..d1a31ae35fb5fd8317ca5e1b1f97eed553008093 100644 (file)
@@ -51,7 +51,7 @@ static struct ns *ns_lookup_name_internal(const char *name);
 
 RB_GENERATE(ns_head, ns, entry, ns_compare)
 
-struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
+static struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
 
 static struct ns *default_ns;
 static int ns_current_ns_fd;
@@ -74,7 +74,8 @@ static inline int ns_map_compare(const struct ns_map_nsid *a,
 RB_HEAD(ns_map_nsid_head, ns_map_nsid);
 RB_PROTOTYPE(ns_map_nsid_head, ns_map_nsid, id_entry, ns_map_compare);
 RB_GENERATE(ns_map_nsid_head, ns_map_nsid, id_entry, ns_map_compare);
-struct ns_map_nsid_head ns_map_nsid_list = RB_INITIALIZER(&ns_map_nsid_list);
+static struct ns_map_nsid_head ns_map_nsid_list =
+               RB_INITIALIZER(&ns_map_nsid_list);
 
 static ns_id_t ns_id_external_numbering;
 
@@ -123,7 +124,7 @@ static int have_netns(void)
 }
 
 /* Holding NS hooks  */
-struct ns_master {
+static struct ns_master {
        int (*ns_new_hook)(struct ns *ns);
        int (*ns_delete_hook)(struct ns *ns);
        int (*ns_enable_hook)(struct ns *ns);
index b0aae4f8df082dd18652478964a226738e1fa9ff..740d2b621ed7d3e0bb2357efb6304fb23a28d8f7 100644 (file)
@@ -34,7 +34,7 @@ static inline int ns_compare(const struct ns *ns, const struct ns *ns2);
 
 RB_GENERATE(ns_head, ns, entry, ns_compare)
 
-struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
+static struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
 
 static inline int ns_compare(const struct ns *a, const struct ns *b)
 {
index 991843a047fc9bb9e1ea7000293657299052b9a3..8d2e7bb3fc7b6aa83a41c6d6ddb4c65d2d9b2f64 100644 (file)
@@ -752,7 +752,7 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
        return CMD_SUCCESS;
 }
 
-struct cmd_node nexthop_group_node = {
+static struct cmd_node nexthop_group_node = {
        NH_GROUP_NODE,
        "%s(config-nh-group)# ",
        1
index 1963b8a35968750efc194319b1614d132fc66ca7..20e0a38e3b3e0d84586188171e7a8c1640199d79 100644 (file)
--- a/lib/ns.h
+++ b/lib/ns.h
@@ -71,8 +71,6 @@ struct ns {
 RB_HEAD(ns_head, ns);
 RB_PROTOTYPE(ns_head, ns, entry, ns_compare)
 
-extern struct ns_head ns_tree;
-
 /*
  * API for managing NETNS. eg from zebra daemon
  * one want to manage the list of NETNS, etc...
index c0e01488b28a1890baa5433160a124e9fec16bc2..14fec0283cafebcb98f9e6559f3b61a5a0172afd 100644 (file)
@@ -221,7 +221,7 @@ struct route_map_match_set_hooks {
                          const char *command, const char *arg);
 };
 
-struct route_map_match_set_hooks rmap_match_set_hook;
+static struct route_map_match_set_hooks rmap_match_set_hook;
 
 /* match interface */
 void route_map_match_interface_hook(int (*func)(
@@ -623,7 +623,7 @@ struct route_map_list {
 
 /* Master list of route map. */
 static struct route_map_list route_map_master = {NULL, NULL, NULL, NULL, NULL};
-struct hash *route_map_master_hash = NULL;
+static struct hash *route_map_master_hash = NULL;
 
 static unsigned int route_map_hash_key_make(const void *p)
 {
@@ -683,7 +683,7 @@ struct route_map_dep_data {
 };
 
 /* Hashes maintaining dependency between various sublists used by route maps */
-struct hash *route_map_dep_hash[ROUTE_MAP_DEP_MAX];
+static struct hash *route_map_dep_hash[ROUTE_MAP_DEP_MAX];
 
 static unsigned int route_map_dep_hash_make_key(const void *p);
 static void route_map_clear_all_references(char *rmap_name);
index 44db48d0060351bb007dec7376aaa6826162957f..16fbbff380be884e3cdfc685e8097074db7d86c7 100644 (file)
@@ -93,8 +93,8 @@ void systemd_send_stopping(void)
 /*
  * How many seconds should we wait between watchdog sends
  */
-int wsecs = 0;
-struct thread_master *systemd_master = NULL;
+static int wsecs = 0;
+static struct thread_master *systemd_master = NULL;
 
 static int systemd_send_watchdog(struct thread *t)
 {
index 2411cc31118d6820274366de314f676e420eef01..6ca6482e085d7e68a634c50b726693e60acd865b 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -67,7 +67,7 @@ static char vrf_default_name[VRF_NAMSIZ] = VRF_DEFAULT_NAME_INTERNAL;
 static int debug_vrf = 0;
 
 /* Holding VRF hooks  */
-struct vrf_master {
+static struct vrf_master {
        int (*vrf_new_hook)(struct vrf *);
        int (*vrf_delete_hook)(struct vrf *);
        int (*vrf_enable_hook)(struct vrf *);
@@ -752,7 +752,7 @@ DEFUN (no_vrf,
 }
 
 
-struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1};
+static struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1};
 
 DEFUN_NOSH (vrf_netns,
        vrf_netns_cmd,
index c08e5e151a6da6f7aea0de797151d3c62f2da6f6..40da8abcd74b575a63fe13a2b40fc0b59a9d0dde 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -89,7 +89,7 @@ static char *vty_ipv6_accesslist_name = NULL;
 static vector Vvty_serv_thread;
 
 /* Current directory. */
-char vty_cwd[MAXPATHLEN];
+static char vty_cwd[MAXPATHLEN];
 
 /* Login password check. */
 static int no_password_check = 0;
index d153f755305a49a77f399bc7517b7f4130b7c394..78ea7d0dd090b6e1cf64d94e074a0e1f2b9b24c5 100644 (file)
@@ -87,7 +87,7 @@ static inline int yang_module_compare(const struct yang_module *a,
 }
 RB_GENERATE(yang_modules, yang_module, entry, yang_module_compare)
 
-struct yang_modules yang_modules = RB_INITIALIZER(&yang_modules);
+static struct yang_modules yang_modules = RB_INITIALIZER(&yang_modules);
 
 struct yang_module *yang_module_load(const char *module_name)
 {
index 6892e36019731b6fd4dfdc9f6c8b7e2fbc0fa90b..ae3e782029a16ee68385fe862071d22a1f85c99a 100644 (file)
@@ -114,9 +114,6 @@ typedef int (*yang_iterate_cb)(const struct lys_node *snode, void *arg);
 /* Global libyang context for native FRR models. */
 extern struct ly_ctx *ly_native_ctx;
 
-/* Tree of all loaded YANG modules. */
-extern struct yang_modules yang_modules;
-
 /*
  * Create a new YANG module and load it using libyang. If the YANG module is not
  * found in the YANG_MODELS_PATH directory, the program will exit with an error.