Raise WARNS to 6:
authorChris Pressey <cpressey@dragonflybsd.org>
Wed, 16 Mar 2005 21:21:34 +0000 (21:21 +0000)
committerChris Pressey <cpressey@dragonflybsd.org>
Wed, 16 Mar 2005 21:21:34 +0000 (21:21 +0000)
- Rename local variables to avoid conflict with globals.

sbin/routed/Makefile
sbin/routed/if.c
sbin/routed/main.c
sbin/routed/output.c
sbin/routed/rdisc.c
sbin/routed/table.c

index 3648586..6a9d607 100644 (file)
@@ -1,9 +1,10 @@
 # Make `routed` for FreeBSD
 # $FreeBSD: src/sbin/routed/Makefile,v 1.8.2.1 2001/04/25 10:58:50 ru Exp $
-# $DragonFly: src/sbin/routed/Makefile,v 1.2 2003/06/17 04:27:34 dillon Exp $
+# $DragonFly: src/sbin/routed/Makefile,v 1.3 2005/03/16 21:21:34 cpressey Exp $
 # $FreeBSD: src/sbin/routed/Makefile,v 1.8.2.1 2001/04/25 10:58:50 ru Exp $
 
 PROG=   routed
+WARNS?=        6
 SRCS=   if.c input.c main.c output.c parms.c radix.c rdisc.c table.c trace.c
 MAN=   routed.8
 SUBDIR= rtquery
index c14a463..462623b 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sbin/routed/if.c,v 1.6.2.1 2000/08/14 17:00:03 sheldonh Exp $
- * $DragonFly: src/sbin/routed/if.c,v 1.4 2004/12/18 21:43:40 swildner Exp $
+ * $DragonFly: src/sbin/routed/if.c,v 1.5 2005/03/16 21:21:34 cpressey Exp $
  */
 
 #include "defs.h"
@@ -215,14 +215,13 @@ ifwithname(char *name,                    /* "ec0" or whatever */
 
 
 struct interface *
-ifwithindex(u_short index,
-           int rescan_ok)
+ifwithindex(u_short idx, int rescan_ok)
 {
        struct interface *ifp;
 
        for (;;) {
                for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) {
-                       if (ifp->int_index == index)
+                       if (ifp->int_index == idx)
                                return ifp;
                }
 
index ac7d7ba..825133b 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sbin/routed/main.c,v 1.11.2.1 2000/08/14 17:00:03 sheldonh Exp $
- * $DragonFly: src/sbin/routed/main.c,v 1.3 2004/12/18 21:43:40 swildner Exp $
+ * $DragonFly: src/sbin/routed/main.c,v 1.4 2005/03/16 21:21:34 cpressey Exp $
  */
 
 #include "defs.h"
@@ -641,7 +641,7 @@ static int                          /* <0 or file descriptor */
 get_rip_sock(naddr addr,
             int serious)               /* 1=failure to bind is serious */
 {
-       struct sockaddr_in sin;
+       struct sockaddr_in in;
        unsigned char ttl;
        int s;
 
@@ -649,14 +649,14 @@ get_rip_sock(naddr addr,
        if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
                BADERR(1,"rip_sock = socket()");
 
-       memset(&sin, 0, sizeof(sin));
+       memset(&in, 0, sizeof(in));
 #ifdef _HAVE_SIN_LEN
-       sin.sin_len = sizeof(sin);
+       in.sin_len = sizeof(in);
 #endif
-       sin.sin_family = AF_INET;
-       sin.sin_port = htons(RIP_PORT);
-       sin.sin_addr.s_addr = addr;
-       if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+       in.sin_family = AF_INET;
+       in.sin_port = htons(RIP_PORT);
+       in.sin_addr.s_addr = addr;
+       if (bind(s, (struct sockaddr *)&in, sizeof(in)) < 0) {
                if (serious)
                        BADERR(errno != EADDRINUSE, "bind(rip_sock)");
                return -1;
index 646ad74..43cc184 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sbin/routed/output.c,v 1.5.2.1 2000/08/14 17:00:03 sheldonh Exp $
- * $DragonFly: src/sbin/routed/output.c,v 1.4 2004/12/18 21:43:40 swildner Exp $
+ * $DragonFly: src/sbin/routed/output.c,v 1.5 2005/03/16 21:21:34 cpressey Exp $
  */
 
 #include "defs.h"
@@ -103,7 +103,7 @@ output(enum output_type type,
        struct rip *buf,
        int size)                       /* this many bytes */
 {
-       struct sockaddr_in sin;
+       struct sockaddr_in in;
        int flags;
        const char *msg;
        int res;
@@ -111,12 +111,12 @@ output(enum output_type type,
        int soc;
        int serrno;
 
-       sin = *dst;
-       if (sin.sin_port == 0)
-               sin.sin_port = htons(RIP_PORT);
+       in = *dst;
+       if (in.sin_port == 0)
+               in.sin_port = htons(RIP_PORT);
 #ifdef _HAVE_SIN_LEN
-       if (sin.sin_len == 0)
-               sin.sin_len = sizeof(sin);
+       if (in.sin_len == 0)
+               in.sin_len = sizeof(in);
 #endif
 
        soc = rip_sock;
@@ -180,7 +180,7 @@ output(enum output_type type,
                                }
                                rip_sock_mcast = ifp;
                        }
-                       sin.sin_addr.s_addr = htonl(INADDR_RIP_GROUP);
+                       in.sin_addr.s_addr = htonl(INADDR_RIP_GROUP);
                }
                break;
 
@@ -193,18 +193,18 @@ output(enum output_type type,
                return -1;
        }
 
-       trace_rip(msg, "to", &sin, ifp, buf, size);
+       trace_rip(msg, "to", &in, ifp, buf, size);
 
        res = sendto(soc, buf, size, flags,
-                    (struct sockaddr *)&sin, sizeof(sin));
+                    (struct sockaddr *)&in, sizeof(in));
        if (res < 0
            && (ifp == 0 || !(ifp->int_state & IS_BROKE))) {
                serrno = errno;
                msglog("%s sendto(%s%s%s.%d): %s", msg,
                       ifp != 0 ? ifp->int_name : "",
                       ifp != 0 ? ", " : "",
-                      inet_ntoa(sin.sin_addr),
-                      ntohs(sin.sin_port),
+                      inet_ntoa(in.sin_addr),
+                      ntohs(in.sin_port),
                       strerror(errno));
                errno = serrno;
        }
index 72ec398..c9209be 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sbin/routed/rdisc.c,v 1.5.2.1 2000/08/14 17:00:04 sheldonh Exp $
- * $DragonFly: src/sbin/routed/rdisc.c,v 1.3 2004/12/18 21:43:40 swildner Exp $
+ * $DragonFly: src/sbin/routed/rdisc.c,v 1.4 2005/03/16 21:21:34 cpressey Exp $
  */
 
 #include "defs.h"
@@ -694,17 +694,17 @@ send_rdisc(union ad_u *p,
           naddr dst,                   /* 0 or unicast destination */
           int  type)                   /* 0=unicast, 1=bcast, 2=mcast */
 {
-       struct sockaddr_in sin;
+       struct sockaddr_in in;
        int flags;
        const char *msg;
        naddr tgt_mcast;
 
 
-       memset(&sin, 0, sizeof(sin));
-       sin.sin_addr.s_addr = dst;
-       sin.sin_family = AF_INET;
+       memset(&in, 0, sizeof(in));
+       in.sin_addr.s_addr = dst;
+       in.sin_family = AF_INET;
 #ifdef _HAVE_SIN_LEN
-       sin.sin_len = sizeof(sin);
+       in.sin_len = sizeof(in);
 #endif
        flags = MSG_DONTROUTE;
 
@@ -717,10 +717,10 @@ send_rdisc(union ad_u *p,
        case 1:                         /* broadcast */
                if (ifp->int_if_flags & IFF_POINTOPOINT) {
                        msg = "Send pt-to-pt";
-                       sin.sin_addr.s_addr = ifp->int_dstaddr;
+                       in.sin_addr.s_addr = ifp->int_dstaddr;
                } else {
                        msg = "Send broadcast";
-                       sin.sin_addr.s_addr = ifp->int_brdaddr;
+                       in.sin_addr.s_addr = ifp->int_brdaddr;
                }
                break;
 
@@ -764,16 +764,16 @@ send_rdisc(union ad_u *p,
        if (rdisc_sock < 0)
                get_rdisc_sock();
 
-       trace_rdisc(msg, ifp->int_addr, sin.sin_addr.s_addr, ifp,
+       trace_rdisc(msg, ifp->int_addr, in.sin_addr.s_addr, ifp,
                    p, p_size);
 
        if (0 > sendto(rdisc_sock, p, p_size, flags,
-                      (struct sockaddr *)&sin, sizeof(sin))) {
+                      (struct sockaddr *)&in, sizeof(in))) {
                if (ifp == 0 || !(ifp->int_state & IS_BROKE))
                        msglog("sendto(%s%s%s): %s",
                               ifp != 0 ? ifp->int_name : "",
                               ifp != 0 ? ", " : "",
-                              inet_ntoa(sin.sin_addr),
+                              inet_ntoa(in.sin_addr),
                               strerror(errno));
                if (ifp != 0)
                        if_sick(ifp);
index 894c5b0..f74110a 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sbin/routed/table.c,v 1.9.2.2 2000/08/14 17:00:04 sheldonh Exp $
- * $DragonFly: src/sbin/routed/table.c,v 1.5 2004/12/18 21:43:40 swildner Exp $
+ * $DragonFly: src/sbin/routed/table.c,v 1.6 2005/03/16 21:21:34 cpressey Exp $
  */
 
 #include "defs.h"
@@ -290,7 +290,7 @@ ag_check(naddr      dst,
         naddr  nhop,
         char   metric,
         char   pref,
-        u_int  seqno,
+        u_int  seqnum,
         u_short tag,
         u_short state,
         void (*out)(struct ag_info *)) /* output using this */
@@ -317,7 +317,7 @@ ag_check(naddr      dst,
                nc_ag.ag_pref = pref;
                nc_ag.ag_tag = tag;
                nc_ag.ag_state = state;
-               nc_ag.ag_seqno = seqno;
+               nc_ag.ag_seqno = seqnum;
                out(&nc_ag);
                return;
        }
@@ -415,8 +415,8 @@ ag_check(naddr      dst,
                        /* The sequence number controls flash updating,
                         * and should be the smaller of the two.
                         */
-                       if (ag->ag_seqno > seqno)
-                               ag->ag_seqno = seqno;
+                       if (ag->ag_seqno > seqnum)
+                               ag->ag_seqno = seqnum;
 
                        /* Some bits are set if they are set on either route,
                         * except when the route is for an interface.
@@ -457,8 +457,8 @@ ag_check(naddr      dst,
                         *
                         * Combine and promote (aggregate) the pair of routes.
                         */
-                       if (seqno > ag->ag_seqno)
-                               seqno = ag->ag_seqno;
+                       if (seqnum > ag->ag_seqno)
+                               seqnum = ag->ag_seqno;
                        if (!AG_IS_REDUN(state))
                                state &= ~AGS_REDUN1;
                        if (AG_IS_REDUN(ag->ag_state))
@@ -519,10 +519,10 @@ ag_check(naddr    dst,
                        pref = x;
 
                        /* take the newest sequence number */
-                       if (seqno >= ag->ag_seqno)
-                               seqno = ag->ag_seqno;
+                       if (seqnum >= ag->ag_seqno)
+                               seqnum = ag->ag_seqno;
                        else
-                               ag->ag_seqno = seqno;
+                               ag->ag_seqno = seqnum;
 
                } else {
                        if (!(state & AGS_AGGREGATE))
@@ -538,10 +538,10 @@ ag_check(naddr    dst,
                        if (!AG_IS_REDUN(state))
                                state &= ~AGS_REDUN1;
                        state &= ~AGS_REDUN0;
-                       if (seqno > ag->ag_seqno)
-                               seqno = ag->ag_seqno;
+                       if (seqnum > ag->ag_seqno)
+                               seqnum = ag->ag_seqno;
                        else
-                               ag->ag_seqno = seqno;
+                               ag->ag_seqno = seqnum;
                }
 
                mask <<= 1;
@@ -602,7 +602,7 @@ ag_check(naddr      dst,
        nag->ag_pref = pref;
        nag->ag_tag = tag;
        nag->ag_state = state;
-       nag->ag_seqno = seqno;
+       nag->ag_seqno = seqnum;
 
        nag->ag_fine = ag;
        if (ag != 0)
@@ -1015,7 +1015,7 @@ rtm_lose(struct rt_msghdr *rtm,
  */
 static int
 get_info_gate(struct sockaddr **sap,
-             struct sockaddr_in *sin)
+             struct sockaddr_in *in)
 {
        struct sockaddr_dl *sdl = (struct sockaddr_dl *)*sap;
        struct interface *ifp;
@@ -1031,12 +1031,12 @@ get_info_gate(struct sockaddr **sap,
        if (ifp == 0)
                return 0;
 
-       sin->sin_addr.s_addr = ifp->int_addr;
+       in->sin_addr.s_addr = ifp->int_addr;
 #ifdef _HAVE_SA_LEN
-       sin->sin_len = sizeof(*sin);
+       in->sin_len = sizeof(*in);
 #endif
-       sin->sin_family = AF_INET;
-       *sap = (struct sockaddr*)sin;
+       in->sin_family = AF_INET;
+       *sap = (struct sockaddr *)in;
 
        return 1;
 }