From 8a7761f76c1934ae4c6a7cf6721538b5eeeae982 Mon Sep 17 00:00:00 2001 From: dyoung Date: Fri, 29 Feb 2008 21:23:55 +0000 Subject: [PATCH] Cosmetic: shorten staircases. Join some lines. --- sys/net/if.c | 56 +++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index d3809e1452db..102f469cc732 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.217 2008/02/07 08:48:16 martin Exp $ */ +/* $NetBSD: if.c,v 1.218 2008/02/29 21:23:55 dyoung Exp $ */ /*- * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.217 2008/02/07 08:48:16 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.218 2008/02/29 21:23:55 dyoung Exp $"); #include "opt_inet.h" @@ -552,8 +552,7 @@ if_deactivate(struct ifnet *ifp) } void -if_purgeaddrs(struct ifnet *ifp, int family, - void (*purgeaddr)(struct ifaddr *)) +if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *)) { struct ifaddr *ifa, *nifa; @@ -1716,18 +1715,17 @@ ifconf(u_long cmd, void *data) if (IFADDR_EMPTY(ifp)) { /* Interface with no addresses - send zero sockaddr. */ memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr)); - if (ifrp != NULL) - { - if (space >= sz) { - error = copyout(&ifr, ifrp, sz); - if (error != 0) - return (error); - ifrp++; space -= sz; - } - } - else + if (ifrp == NULL) { space += sz; - continue; + continue; + } + if (space >= sz) { + error = copyout(&ifr, ifrp, sz); + if (error != 0) + return error; + ifrp++; + space -= sz; + } } IFADDR_FOREACH(ifa, ifp) { @@ -1735,27 +1733,23 @@ ifconf(u_long cmd, void *data) /* all sockaddrs must fit in sockaddr_storage */ KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru)); - if (ifrp != NULL) - { - memcpy(&ifr.ifr_space, sa, sa->sa_len); - if (space >= sz) { - error = copyout(&ifr, ifrp, sz); - if (error != 0) - return (error); - ifrp++; space -= sz; - } - } - else + if (ifrp == NULL) { space += sz; + continue; + } + memcpy(&ifr.ifr_space, sa, sa->sa_len); + if (space >= sz) { + error = copyout(&ifr, ifrp, sz); + if (error != 0) + return (error); + ifrp++; space -= sz; + } } } - if (ifrp != NULL) - { + if (ifrp != NULL) { KASSERT(0 <= space && space <= ifc->ifc_len); ifc->ifc_len -= space; - } - else - { + } else { KASSERT(space >= 0); ifc->ifc_len = space; }