]> git.puffer.fish Git - mirror/frr.git/commitdiff
babeld: address some other compilation warnings.
authorMatthieu Boutier <boutier@pps.jussieu.fr>
Sun, 8 Jan 2012 15:43:08 +0000 (16:43 +0100)
committerPaul Jakma <paul@quagga.net>
Sun, 25 Mar 2012 16:06:52 +0000 (17:06 +0100)
babeld/babel_interface.c
babeld/neighbour.c
babeld/route.h
babeld/util.h

index ff9c5eb473461e2257a2de130fe09a46fdffe37c..4bd4499a3d9b7ea22c7b97be58f93acde05d7ca7 100644 (file)
@@ -61,7 +61,7 @@ static int interface_reset(struct interface *ifp);
 static int babel_if_new_hook    (struct interface *ifp);
 static int babel_if_delete_hook (struct interface *ifp);
 static int interface_config_write (struct vty *vty);
-static babel_interface_nfo * babel_interface_allocate ();
+static babel_interface_nfo * babel_interface_allocate (void);
 static void babel_interface_free (babel_interface_nfo *bi);
 
 
@@ -738,7 +738,7 @@ interface_config_write (struct vty *vty)
 /* functions to allocate or free memory for a babel_interface_nfo, filling
  needed fields */
 static babel_interface_nfo *
-babel_interface_allocate ()
+babel_interface_allocate (void)
 {
     babel_interface_nfo *babel_ifp;
     babel_ifp = XMALLOC(MTYPE_BABEL_IF, sizeof(babel_interface_nfo));
index 43da8e09d1c134a8b8e91c0e30be9eaf5e1eda86..f360b8915848f100ca7ecc33f94af84b5983e719 100644 (file)
@@ -217,13 +217,13 @@ reset_txcost(struct neighbour *neigh)
 
     delay = timeval_minus_msec(&babel_now, &neigh->ihu_time);
 
-    if(neigh->ihu_interval > 0 && delay < neigh->ihu_interval * 10 * 3)
+    if(neigh->ihu_interval > 0 && delay < neigh->ihu_interval * 10U * 3U)
         return 0;
 
     /* If we're losing a lot of packets, we probably lost an IHU too */
     if(delay >= 180000 || (neigh->reach & 0xFFF0) == 0 ||
        (neigh->ihu_interval > 0 &&
-        delay >= neigh->ihu_interval * 10 * 10)) {
+        delay >= neigh->ihu_interval * 10U * 10U)) {
         neigh->txcost = INFINITY;
         neigh->ihu_time = babel_now;
         return 1;
@@ -266,9 +266,9 @@ check_neighbours()
         update_neighbour_metric(neigh, changed);
 
         if(neigh->hello_interval > 0)
-            msecs = MIN(msecs, neigh->hello_interval * 10);
+            msecs = MIN(msecs, neigh->hello_interval * 10U);
         if(neigh->ihu_interval > 0)
-            msecs = MIN(msecs, neigh->ihu_interval * 10);
+            msecs = MIN(msecs, neigh->ihu_interval * 10U);
         neigh = neigh->next;
     }
 
index dbb205d189dffaed918afef818364c2f58ed3138..e38f157729b57fa3402e7ab75509793d5dce19ea 100644 (file)
@@ -52,7 +52,7 @@ struct babel_route {
     short installed;
 };
 
-static inline int
+static inline unsigned short
 route_metric(const struct babel_route *route)
 {
     return route->metric;
index d653b613ef1e347ccbeab20fa3ba17ff03a98cf4..4e7635f63a1a680bdaf000eb19b0244d531b3181 100644 (file)
@@ -42,10 +42,10 @@ THE SOFTWARE.
 #include "log.h"
 
 #if defined(i386) || defined(__mc68020__) || defined(__x86_64__)
-#define DO_NTOHS(_d, _s) do { _d = ntohs(*(unsigned short*)(_s)); } while(0)
-#define DO_NTOHL(_d, _s) do { _d = ntohl(*(unsigned*)(_s)); } while(0)
-#define DO_HTONS(_d, _s) do { *(unsigned short*)(_d) = htons(_s); } while(0)
-#define DO_HTONL(_d, _s) do { *(unsigned*)(_d) = htonl(_s); } while(0)
+#define DO_NTOHS(_d, _s) do{ _d = ntohs(*(const unsigned short*)(_s)); }while(0)
+#define DO_NTOHL(_d, _s) do{ _d = ntohl(*(const unsigned*)(_s)); } while(0)
+#define DO_HTONS(_d, _s) do{ *(unsigned short*)(_d) = htons(_s); } while(0)
+#define DO_HTONL(_d, _s) do{ *(unsigned*)(_d) = htonl(_s); } while(0)
 /* Some versions of gcc seem to be buggy, and ignore the packed attribute.
    Disable this code until the issue is clarified. */
 /* #elif defined __GNUC__*/