From c7c53fa88ccdbc2d48cf7327c9e4f33cdc517a8a Mon Sep 17 00:00:00 2001 From: Matthieu Boutier Date: Sun, 8 Jan 2012 16:43:08 +0100 Subject: babeld: address some other compilation warnings. --- babeld/babel_interface.c | 4 ++-- babeld/neighbour.c | 8 ++++---- babeld/route.h | 2 +- babeld/util.h | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index ff9c5eb4..4bd4499a 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -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)); diff --git a/babeld/neighbour.c b/babeld/neighbour.c index 43da8e09..f360b891 100644 --- a/babeld/neighbour.c +++ b/babeld/neighbour.c @@ -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; } diff --git a/babeld/route.h b/babeld/route.h index dbb205d1..e38f1577 100644 --- a/babeld/route.h +++ b/babeld/route.h @@ -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; diff --git a/babeld/util.h b/babeld/util.h index d653b613..4e7635f6 100644 --- a/babeld/util.h +++ b/babeld/util.h @@ -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__*/ -- cgit v1.2.1