diff options
author | Renato Westphal <renato@cvs.openbsd.org> | 2016-09-02 16:44:34 +0000 |
---|---|---|
committer | Renato Westphal <renato@cvs.openbsd.org> | 2016-09-02 16:44:34 +0000 |
commit | fcf9752bb7cfa0955234368e43600610c4308242 (patch) | |
tree | f12e2cdd668aab5d8339150fa1af1dfada1dda77 /usr.sbin/eigrpd/rde.c | |
parent | dcaa3316f517f3e75debd2dc1ae2838de28a7b02 (diff) |
Make functions and variables static whenever possible.
style(9) says:
"Function prototypes for private functions (i.e., functions not used
elsewhere) go at the top of the first source module. In userland,
functions local to one source module should be declared 'static'".
The benefits of doing so include:
* clean up of the eigrpd global namespace;
* improved readability;
* more hints to the compiler/linker to generate more efficient code.
Additional changes:
* Declare all extern variables in header files;
* Clean up the indentation of all function prototypes and global
variables.
ok claudio@ benno@
Diffstat (limited to 'usr.sbin/eigrpd/rde.c')
-rw-r--r-- | usr.sbin/eigrpd/rde.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/usr.sbin/eigrpd/rde.c b/usr.sbin/eigrpd/rde.c index 6eb797ca0b2..aea52e4f66c 100644 --- a/usr.sbin/eigrpd/rde.c +++ b/usr.sbin/eigrpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.21 2016/09/02 16:39:44 renato Exp $ */ +/* $OpenBSD: rde.c,v 1.22 2016/09/02 16:44:33 renato Exp $ */ /* * Copyright (c) 2015 Renato Westphal <renato@openbsd.org> @@ -35,25 +35,23 @@ #include "rde.h" #include "log.h" -void rde_sig_handler(int sig, short, void *); -__dead void rde_shutdown(void); -void rde_dispatch_imsg(int, short, void *); -void rde_dispatch_parent(int, short, void *); +static void rde_sig_handler(int sig, short, void *); +static __dead void rde_shutdown(void); +static void rde_dispatch_imsg(int, short, void *); +static void rde_dispatch_parent(int, short, void *); +static struct redistribute *eigrp_redistribute(struct eigrp *, struct kroute *); +static void rt_redist_set(struct kroute *, int); +static void rt_snap(struct rde_nbr *); +static struct ctl_rt *rt_to_ctl(struct rt_node *, struct eigrp_route *); +static void rt_dump(struct ctl_show_topology_req *, pid_t); struct eigrpd_conf *rdeconf; -struct imsgev *iev_eigrpe; -struct imsgev *iev_main; -extern struct iface_id_head ifaces_by_id; -RB_PROTOTYPE(iface_id_head, eigrp_iface, id_tree, iface_id_compare) - -RB_PROTOTYPE(rt_tree, rt_node, entry, rt_compare) - -extern struct rde_nbr_head rde_nbrs; -RB_PROTOTYPE(rde_nbr_head, rde_nbr, entry, rde_nbr_compare) +static struct imsgev *iev_eigrpe; +static struct imsgev *iev_main; /* ARGSUSED */ -void +static void rde_sig_handler(int sig, short event, void *arg) { /* @@ -133,7 +131,7 @@ rde(int debug, int verbose) return (0); } -__dead void +static __dead void rde_shutdown(void) { /* close pipes */ @@ -167,7 +165,7 @@ rde_imsg_compose_eigrpe(int type, uint32_t peerid, pid_t pid, void *data, } /* ARGSUSED */ -void +static void rde_dispatch_imsg(int fd, short event, void *bula) { struct imsgev *iev = bula; @@ -301,7 +299,7 @@ rde_dispatch_imsg(int fd, short event, void *bula) } /* ARGSUSED */ -void +static void rde_dispatch_parent(int fd, short event, void *bula) { static struct eigrpd_conf *nconf; @@ -639,7 +637,7 @@ eigrp_redistribute(struct eigrp *eigrp, struct kroute *kr) return (NULL); } -void +static void rt_redist_set(struct kroute *kr, int withdraw) { struct eigrp *eigrp; @@ -683,7 +681,7 @@ rt_redist_set(struct kroute *kr, int withdraw) ri.metric.flags = 0; /* external metric */ - ri.emetric.routerid = htonl(eigrp_router_id(rdeconf)); + ri.emetric.routerid = htonl(rdeconf->rtr_id.s_addr); ri.emetric.as = r->emetric.as; ri.emetric.tag = r->emetric.tag; ri.emetric.metric = r->emetric.metric; @@ -720,7 +718,7 @@ rt_summary_set(struct eigrp *eigrp, struct summary_addr *summary, } /* send all known routing information to new neighbor */ -void +static void rt_snap(struct rde_nbr *nbr) { struct eigrp *eigrp = nbr->eigrp; @@ -739,7 +737,7 @@ rt_snap(struct rde_nbr *nbr) NULL, 0); } -struct ctl_rt * +static struct ctl_rt * rt_to_ctl(struct rt_node *rn, struct eigrp_route *route) { static struct ctl_rt rtctl; @@ -782,7 +780,7 @@ rt_to_ctl(struct rt_node *rn, struct eigrp_route *route) return (&rtctl); } -void +static void rt_dump(struct ctl_show_topology_req *treq, pid_t pid) { struct eigrp *eigrp; |