Cosmetic: remove superfluous parentheses. Compare pointers with
NULL instead of testing "truth." Remove unnecessary casts to void* in memset() calls.
This commit is contained in:
parent
49412ed4f9
commit
edc2327d04
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route.c,v 1.94 2007/07/19 20:48:53 dyoung Exp $ */
|
||||
/* $NetBSD: route.c,v 1.95 2007/07/21 03:12:10 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -100,7 +100,7 @@
|
||||
#include "opt_route.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.94 2007/07/19 20:48:53 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.95 2007/07/21 03:12:10 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -354,7 +354,7 @@ rtalloc1(const struct sockaddr *dst, int report)
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
return (newrt);
|
||||
return newrt;
|
||||
}
|
||||
|
||||
void
|
||||
@ -449,7 +449,7 @@ rtredirect(const struct sockaddr *dst, const struct sockaddr *gateway,
|
||||
* which use routing redirects generated by smart gateways
|
||||
* to dynamically build the routing tables.
|
||||
*/
|
||||
if ((rt == NULL) || (rt_mask(rt) && rt_mask(rt)->sa_len < 2))
|
||||
if (rt == NULL || (rt_mask(rt) && rt_mask(rt)->sa_len < 2))
|
||||
goto create;
|
||||
/*
|
||||
* Don't listen to the redirect if it's
|
||||
@ -462,7 +462,7 @@ rtredirect(const struct sockaddr *dst, const struct sockaddr *gateway,
|
||||
* Create new route, rather than smashing route to net.
|
||||
*/
|
||||
create:
|
||||
if (rt)
|
||||
if (rt != NULL)
|
||||
rtfree(rt);
|
||||
flags |= RTF_GATEWAY | RTF_DYNAMIC;
|
||||
info.rti_info[RTAX_DST] = dst;
|
||||
@ -489,7 +489,7 @@ rtredirect(const struct sockaddr *dst, const struct sockaddr *gateway,
|
||||
error = EHOSTUNREACH;
|
||||
done:
|
||||
if (rt) {
|
||||
if (rtp && !error)
|
||||
if (rtp != NULL && !error)
|
||||
*rtp = rt;
|
||||
else
|
||||
rtfree(rt);
|
||||
@ -499,7 +499,7 @@ out:
|
||||
rtstat.rts_badredirect++;
|
||||
else if (stat != NULL)
|
||||
(*stat)++;
|
||||
memset((void *)&info, 0, sizeof(info));
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.rti_info[RTAX_DST] = dst;
|
||||
info.rti_info[RTAX_GATEWAY] = gateway;
|
||||
info.rti_info[RTAX_NETMASK] = netmask;
|
||||
@ -521,7 +521,7 @@ rtdeletemsg(struct rtentry *rt)
|
||||
* deleted. That will allow the information being reported to
|
||||
* be accurate (and consistent with route_output()).
|
||||
*/
|
||||
memset((void *)&info, 0, sizeof(info));
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.rti_info[RTAX_DST] = rt_getkey(rt);
|
||||
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
|
||||
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
|
||||
@ -535,7 +535,7 @@ rtdeletemsg(struct rtentry *rt)
|
||||
rt->rt_refcnt++;
|
||||
rtfree(rt);
|
||||
}
|
||||
return (error);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -566,7 +566,7 @@ rtflushclone(sa_family_t family, struct rtentry *parent)
|
||||
int
|
||||
rtioctl(u_long req, void *data, struct lwp *l)
|
||||
{
|
||||
return (EOPNOTSUPP);
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
struct ifaddr *
|
||||
@ -611,7 +611,7 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst,
|
||||
if (ifa == 0)
|
||||
ifa = oifa;
|
||||
}
|
||||
return (ifa);
|
||||
return ifa;
|
||||
}
|
||||
|
||||
#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
|
||||
@ -846,7 +846,7 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt)
|
||||
}
|
||||
bad:
|
||||
splx(s);
|
||||
return (error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1156,7 +1156,7 @@ rt_timer_add(struct rtentry *rt,
|
||||
TAILQ_INSERT_TAIL(&queue->rtq_head, r, rtt_next);
|
||||
r->rtt_queue->rtq_count++;
|
||||
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
Loading…
Reference in New Issue
Block a user