Source-Changes-HG archive

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

[src/trunk]: src/games/hunt/hunt Remove unsafe and unnecessary pointer casts.



details:   https://anonhg.NetBSD.org/src/rev/e000c3d8fd0f
branches:  trunk
changeset: 794982:e000c3d8fd0f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 29 20:53:55 2014 +0000

description:
Remove unsafe and unnecessary pointer casts.

diffstat:

 games/hunt/hunt/hunt.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (55 lines):

diff -r 3832d636342f -r e000c3d8fd0f games/hunt/hunt/hunt.c
--- a/games/hunt/hunt/hunt.c    Sat Mar 29 20:52:13 2014 +0000
+++ b/games/hunt/hunt/hunt.c    Sat Mar 29 20:53:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hunt.c,v 1.42 2014/03/29 20:52:13 dholland Exp $       */
+/*     $NetBSD: hunt.c,v 1.43 2014/03/29 20:53:55 dholland Exp $       */
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.42 2014/03/29 20:52:13 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.43 2014/03/29 20:53:55 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -99,7 +99,7 @@
 static void sigusr1(int) __dead;
 static void find_driver(bool);
 static void start_driver(void);
-static int broadcast_vec(int, struct sockaddr **);
+static int broadcast_vec(int, struct sockaddr_in **);
 #ifdef INTERNET
 static SOCKET *list_drivers(void);
 #endif
@@ -337,7 +337,7 @@
 
 #ifdef INTERNET
 static int
-broadcast_vec(int s /*socket*/, struct sockaddr **vector)
+broadcast_vec(int s /*socket*/, struct sockaddr_in **vector)
 {
        int vec_cnt;
        struct ifaddrs *ifp, *ip;
@@ -352,8 +352,7 @@
                    (ip->ifa_flags & IFF_BROADCAST))
                        vec_cnt++;
 
-       *vector = (struct sockaddr *)
-               malloc(vec_cnt * sizeof(struct sockaddr_in));
+       *vector = malloc(vec_cnt * sizeof(struct sockaddr_in));
 
        vec_cnt = 0;
        for (ip = ifp; ip; ip = ip->ifa_next)
@@ -432,7 +431,7 @@
        }
 
        if (initial)
-               brdc = broadcast_vec(test_socket, (void *) &brdv);
+               brdc = broadcast_vec(test_socket, &brdv);
 
 #ifdef SO_BROADCAST
        /* Sun's will broadcast even though this option can't be set */



Home | Main Index | Thread Index | Old Index