Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Improve the readability of one small piece of code.



details:   https://anonhg.NetBSD.org/src/rev/26cf94ab136c
branches:  trunk
changeset: 481494:26cf94ab136c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Feb 01 00:18:29 2000 +0000

description:
Improve the readability of one small piece of code.

diffstat:

 sys/netinet6/in6_pcb.c |  14 ++++++++------
 sys/netns/ns_pcb.c     |   8 +++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diffs (53 lines):

diff -r 72f0a83c9789 -r 26cf94ab136c sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c    Tue Feb 01 00:15:22 2000 +0000
+++ b/sys/netinet6/in6_pcb.c    Tue Feb 01 00:18:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_pcb.c,v 1.14 2000/01/31 14:19:02 itojun Exp $      */
+/*     $NetBSD: in6_pcb.c,v 1.15 2000/02/01 00:18:29 thorpej Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -234,11 +234,13 @@
                         * XXX: bind to an anycast address might accidentally
                         * cause sending a packet with anycast source address.
                         */
-                       if (ia &&
-                           ((struct in6_ifaddr *)ia)->ia6_flags &
-                           (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
-                            IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
-                               return(EADDRNOTAVAIL);
+                       if (ia != NULL) {
+                               struct in6_ifaddr *ia6 = (void *)ia;
+                               
+                               if (ia6->ia6_flags &
+                                   (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
+                                    IN6_IFF_DETACHED|IN6_IFF_DEPRECATED))
+                                       return (EADDRNOTAVAIL);
                        }
                }
                if (lport) {
diff -r 72f0a83c9789 -r 26cf94ab136c sys/netns/ns_pcb.c
--- a/sys/netns/ns_pcb.c        Tue Feb 01 00:15:22 2000 +0000
+++ b/sys/netns/ns_pcb.c        Tue Feb 01 00:18:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ns_pcb.c,v 1.12 1997/07/18 19:30:41 thorpej Exp $      */
+/*     $NetBSD: ns_pcb.c,v 1.13 2000/02/01 00:20:14 thorpej Exp $      */
 
 /*
  * Copyright (c) 1984, 1985, 1986, 1987, 1993
@@ -192,11 +192,13 @@
                 * If we found a route, use the address
                 * corresponding to the outgoing interface
                 */
-               if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp))
+               if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp)) {
                        for (ia = ns_ifaddr.tqh_first; ia != 0;
-                           ia = ia->ia_list.tqe_next)
+                           ia = ia->ia_list.tqe_next) {
                                if (ia->ia_ifp == ifp)
                                        break;
+                       }
+               }
                if (ia == 0) {
                        u_int16_t fport = sns->sns_addr.x_port;
                        sns->sns_addr.x_port = 0;



Home | Main Index | Thread Index | Old Index