Initialize some local variables earlier

Move the initialization of these variables to the beginning of their
respective functions.

On our end this creates a small amount of unneeded churn, as these
variables are properly initialized before their first use in all cases.
However, changing this benefits at least one downstream consumer
(NetApp) by allowing local and future modifications to these functions
to be made without worrying about where the initialization occurs.

Reviewed by:	melifaro, rscheff
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26454
This commit is contained in:
Mitchell Horne 2020-09-18 14:01:10 +00:00
parent 085e04945c
commit 374ce2488a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365881
2 changed files with 3 additions and 6 deletions

View File

@ -323,11 +323,11 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
struct ifnet *ifp = NULL; /* keep compiler happy */
struct mbuf *m0;
int hlen = sizeof (struct ip);
int mtu;
int mtu = 0;
int error = 0;
struct sockaddr_in *dst, sin;
const struct sockaddr_in *gw;
struct in_ifaddr *ia;
struct in_ifaddr *ia = NULL;
struct in_addr src;
int isbroadcast;
uint16_t ip_len, ip_off;
@ -485,7 +485,6 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
* possible that a matching SPD entry exists.
*/
no_route_but_check_spd = 1;
mtu = 0; /* Silence GCC warning. */
goto sendit;
#endif
IPSTAT_INC(ips_noroute);
@ -521,7 +520,6 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
* possible that a matching SPD entry exists.
*/
no_route_but_check_spd = 1;
mtu = 0; /* Silence GCC warning. */
goto sendit;
#endif
IPSTAT_INC(ips_noroute);

View File

@ -1151,7 +1151,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
struct epoch_tracker et;
int cscov_partial = 0;
int error = 0;
int ipflags;
int ipflags = 0;
u_short fport, lport;
u_char tos;
uint8_t pr;
@ -1435,7 +1435,6 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
ip->ip_off |= htons(IP_DF);
}
ipflags = 0;
if (inp->inp_socket->so_options & SO_DONTROUTE)
ipflags |= IP_ROUTETOIF;
if (inp->inp_socket->so_options & SO_BROADCAST)