Module Name:    src
Committed By:   dholland
Date:           Sat Jul  4 01:01:19 UTC 2009

Modified Files:
        src/games/hunt/huntd: answer.c ctl_transact.c driver.c execute.c expl.c
            faketalk.c get_names.c shots.c

Log Message:
Remove a pile of bogus casts. One object file diff, crosschecked and
found harmless.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/games/hunt/huntd/answer.c
cvs rdiff -u -r1.6 -r1.7 src/games/hunt/huntd/ctl_transact.c \
    src/games/hunt/huntd/execute.c
cvs rdiff -u -r1.14 -r1.15 src/games/hunt/huntd/driver.c
cvs rdiff -u -r1.4 -r1.5 src/games/hunt/huntd/expl.c
cvs rdiff -u -r1.12 -r1.13 src/games/hunt/huntd/faketalk.c
cvs rdiff -u -r1.7 -r1.8 src/games/hunt/huntd/get_names.c \
    src/games/hunt/huntd/shots.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hunt/huntd/answer.c
diff -u src/games/hunt/huntd/answer.c:1.11 src/games/hunt/huntd/answer.c:1.12
--- src/games/hunt/huntd/answer.c:1.11	Sun Jun 28 21:12:35 2009
+++ src/games/hunt/huntd/answer.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: answer.c,v 1.11 2009/06/28 21:12:35 dholland Exp $	*/
+/*	$NetBSD: answer.c,v 1.12 2009/07/04 01:01:18 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: answer.c,v 1.11 2009/06/28 21:12:35 dholland Exp $");
+__RCSID("$NetBSD: answer.c,v 1.12 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 # include	<ctype.h>
@@ -90,15 +90,15 @@
 		machine = gethostid();
 # endif
 	version = htonl((u_int32_t) HUNT_VERSION);
-	(void) write(newsock, (char *) &version, LONGLEN);
-	(void) read(newsock, (char *) &uid, LONGLEN);
+	(void) write(newsock, &version, LONGLEN);
+	(void) read(newsock, &uid, LONGLEN);
 	uid = ntohl(uid);
 	(void) read(newsock, name, NAMELEN);
 	(void) read(newsock, &team, 1);
-	(void) read(newsock, (char *) &enter_status, LONGLEN);
+	(void) read(newsock, &enter_status, LONGLEN);
 	enter_status = ntohl((unsigned long) enter_status);
 	(void) read(newsock, Ttyname, NAMELEN);
-	(void) read(newsock, (char *) &mode, sizeof mode);
+	(void) read(newsock, &mode, sizeof mode);
 	mode = ntohl(mode);
 
 	/*
@@ -161,7 +161,7 @@
 			i = pp - Monitor + MAXPL + 3;
 		} else {
 			socklen = 0;
-			(void) write(newsock, (char *) &socklen,
+			(void) write(newsock, &socklen,
 				sizeof socklen);
 			(void) close(newsock);
 			return FALSE;
@@ -173,7 +173,7 @@
 			i = pp - Player + 3;
 		} else {
 			socklen = 0;
-			(void) write(newsock, (char *) &socklen,
+			(void) write(newsock, &socklen,
 				sizeof socklen);
 			(void) close(newsock);
 			return FALSE;
@@ -409,7 +409,7 @@
 		ip->i_score = ip->i_kills / (double) ip->i_entries;
 	}
 	else {
-		ip = (IDENT *) malloc(sizeof (IDENT));
+		ip = malloc(sizeof(*ip));
 		if (ip == NULL) {
 			/* Fourth down, time to punt */
 			ip = &punt;

Index: src/games/hunt/huntd/ctl_transact.c
diff -u src/games/hunt/huntd/ctl_transact.c:1.6 src/games/hunt/huntd/ctl_transact.c:1.7
--- src/games/hunt/huntd/ctl_transact.c:1.6	Wed Jun 11 12:00:22 2003
+++ src/games/hunt/huntd/ctl_transact.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctl_transact.c,v 1.6 2003/06/11 12:00:22 wiz Exp $	*/
+/*	$NetBSD: ctl_transact.c,v 1.7 2009/07/04 01:01:18 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)ctl_transact.c	5.2 (Berkeley) 3/13/86";
 #else
-__RCSID("$NetBSD: ctl_transact.c,v 1.6 2003/06/11 12:00:22 wiz Exp $");
+__RCSID("$NetBSD: ctl_transact.c,v 1.7 2009/07/04 01:01:18 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -80,7 +80,7 @@
 	do {
 		/* resend message until a response is obtained */
 		for (retries = MAX_RETRY; retries > 0; retries -= 1) {
-			cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0,
+			cc = sendto(ctl_sockt, &msg, sizeof (msg), 0,
 				&daemon_addr, sizeof (daemon_addr));
 			if (cc != sizeof (msg)) {
 				if (errno == EINTR)
@@ -104,7 +104,7 @@
 		 * request/acknowledgements being sent)
 		 */
 		do {
-			cc = recv(ctl_sockt, (char *)rp, sizeof (*rp), 0);
+			cc = recv(ctl_sockt, rp, sizeof (*rp), 0);
 			if (cc < 0) {
 				if (errno == EINTR)
 					continue;
Index: src/games/hunt/huntd/execute.c
diff -u src/games/hunt/huntd/execute.c:1.6 src/games/hunt/huntd/execute.c:1.7
--- src/games/hunt/huntd/execute.c:1.6	Sun Jun 28 21:12:35 2009
+++ src/games/hunt/huntd/execute.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: execute.c,v 1.6 2009/06/28 21:12:35 dholland Exp $	*/
+/*	$NetBSD: execute.c,v 1.7 2009/07/04 01:01:18 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: execute.c,v 1.6 2009/06/28 21:12:35 dholland Exp $");
+__RCSID("$NetBSD: execute.c,v 1.7 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 # include	<stdlib.h>
@@ -496,7 +496,7 @@
 {
 	BULLET	*bp;
 
-	bp = (BULLET *) malloc(sizeof (BULLET));	/* NOSTRICT */
+	bp = malloc(sizeof(*bp));
 	if (bp == NULL) {
 		if (owner != NULL)
 			message(owner, "Out of memory");

Index: src/games/hunt/huntd/driver.c
diff -u src/games/hunt/huntd/driver.c:1.14 src/games/hunt/huntd/driver.c:1.15
--- src/games/hunt/huntd/driver.c:1.14	Sun Jun 28 21:12:35 2009
+++ src/games/hunt/huntd/driver.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: driver.c,v 1.14 2009/06/28 21:12:35 dholland Exp $	*/
+/*	$NetBSD: driver.c,v 1.15 2009/07/04 01:01:18 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: driver.c,v 1.14 2009/06/28 21:12:35 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.15 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 # include	<sys/ioctl.h>
@@ -145,20 +145,20 @@
 		if (fdset[2].revents & POLLIN) {
 			namelen = DAEMON_SIZE;
 			port_num = htons(sock_port);
-			(void) recvfrom(Test_socket, (char *) &msg, sizeof msg,
+			(void) recvfrom(Test_socket, &msg, sizeof msg,
 				0, (struct sockaddr *) &test, &namelen);
 			switch (ntohs(msg)) {
 			  case C_MESSAGE:
 				if (Nplayer <= 0)
 					break;
 				reply = htons((u_short) Nplayer);
-				(void) sendto(Test_socket, (char *) &reply,
+				(void) sendto(Test_socket, &reply,
 					sizeof reply, 0,
 					(struct sockaddr *) &test, DAEMON_SIZE);
 				break;
 			  case C_SCORES:
 				reply = htons(stat_port);
-				(void) sendto(Test_socket, (char *) &reply,
+				(void) sendto(Test_socket, &reply,
 					sizeof reply, 0,
 					(struct sockaddr *) &test, DAEMON_SIZE);
 				break;
@@ -167,7 +167,7 @@
 				if (msg == C_MONITOR && Nplayer <= 0)
 					break;
 				reply = htons(sock_port);
-				(void) sendto(Test_socket, (char *) &reply,
+				(void) sendto(Test_socket, &reply,
 					sizeof reply, 0,
 					(struct sockaddr *) &test, DAEMON_SIZE);
 				break;
@@ -977,7 +977,7 @@
 
 	for (ip = Scores; ip != NULL; ip = nextip) {
 		nextip = ip->i_next;
-		(void) free((char *) ip);
+		(void) free(ip);
 	}
 	Scores = NULL;
 }

Index: src/games/hunt/huntd/expl.c
diff -u src/games/hunt/huntd/expl.c:1.4 src/games/hunt/huntd/expl.c:1.5
--- src/games/hunt/huntd/expl.c:1.4	Tue Jan 27 20:30:29 2004
+++ src/games/hunt/huntd/expl.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: expl.c,v 1.4 2004/01/27 20:30:29 jsm Exp $	*/
+/*	$NetBSD: expl.c,v 1.5 2009/07/04 01:01:18 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: expl.c,v 1.4 2004/01/27 20:30:29 jsm Exp $");
+__RCSID("$NetBSD: expl.c,v 1.5 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 # include	<stdlib.h>
@@ -57,7 +57,7 @@
 		return;
 	if (x < 0 || x >= WIDTH)
 		return;
-	ep = (EXPL *) malloc(sizeof (EXPL));	/* NOSTRICT */
+	ep = malloc(sizeof(*ep));
 	ep->e_y = y;
 	ep->e_x = x;
 	ep->e_char = type;
@@ -132,7 +132,7 @@
 		for (pp = Monitor; pp < End_monitor; pp++)
 			check(pp, y, x);
 # endif
-		free((char *) ep);
+		free(ep);
 	}
 	for (x = EXPLEN - 1; x > 0; x--)
 		Expl[x] = Expl[x - 1];

Index: src/games/hunt/huntd/faketalk.c
diff -u src/games/hunt/huntd/faketalk.c:1.12 src/games/hunt/huntd/faketalk.c:1.13
--- src/games/hunt/huntd/faketalk.c:1.12	Sun Jun 28 21:12:35 2009
+++ src/games/hunt/huntd/faketalk.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: faketalk.c,v 1.12 2009/06/28 21:12:35 dholland Exp $	*/
+/*	$NetBSD: faketalk.c,v 1.13 2009/07/04 01:01:18 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: faketalk.c,v 1.12 2009/06/28 21:12:35 dholland Exp $");
+__RCSID("$NetBSD: faketalk.c,v 1.13 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 #include "bsd.h"
@@ -123,7 +123,7 @@
 	 *	start fetching addresses
 	 */
 
-	if ((sp = getservbyname("smtp", (char *) NULL)) == NULL) {
+	if ((sp = getservbyname("smtp", NULL)) == NULL) {
 # ifdef LOG
 		syslog(LOG_ERR, "faketalk: smtp protocol not supported\n");
 # else
@@ -239,7 +239,7 @@
 	msg.type = DELETE;
 	msg.id_num = (int) htonl(response.id_num);
 	daemon_addr.sin_addr = his_machine_addr;
-	if (sendto(ctl_sockt, (char *) &msg, sizeof (msg), 0,
+	if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
 			(struct sockaddr *) &daemon_addr, sizeof(daemon_addr))
 			!= sizeof(msg))
 		p_error("send delete remote");

Index: src/games/hunt/huntd/get_names.c
diff -u src/games/hunt/huntd/get_names.c:1.7 src/games/hunt/huntd/get_names.c:1.8
--- src/games/hunt/huntd/get_names.c:1.7	Wed Jun 11 12:00:22 2003
+++ src/games/hunt/huntd/get_names.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: get_names.c,v 1.7 2003/06/11 12:00:22 wiz Exp $	*/
+/*	$NetBSD: get_names.c,v 1.8 2009/07/04 01:01:18 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: get_names.c,v 1.7 2003/06/11 12:00:22 wiz Exp $");
+__RCSID("$NetBSD: get_names.c,v 1.8 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 #include "bsd.h"
@@ -146,7 +146,7 @@
 	msg.r_name[NAME_SIZE - 1] = '\0';
 
 	/* if he is on the same machine, then simply copy */
-	if (memcmp((char *) &his_machine_name, (char *) &my_machine_name,
+	if (memcmp(&his_machine_name, &my_machine_name,
 						sizeof(his_machine_name)) == 0)
 		memcpy(&his_machine_addr, &my_machine_addr,
 						sizeof(his_machine_name));
Index: src/games/hunt/huntd/shots.c
diff -u src/games/hunt/huntd/shots.c:1.7 src/games/hunt/huntd/shots.c:1.8
--- src/games/hunt/huntd/shots.c:1.7	Sun Jun 28 21:12:35 2009
+++ src/games/hunt/huntd/shots.c	Sat Jul  4 01:01:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: shots.c,v 1.7 2009/06/28 21:12:35 dholland Exp $	*/
+/*	$NetBSD: shots.c,v 1.8 2009/07/04 01:01:18 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: shots.c,v 1.7 2009/06/28 21:12:35 dholland Exp $");
+__RCSID("$NetBSD: shots.c,v 1.8 2009/07/04 01:01:18 dholland Exp $");
 #endif /* not lint */
 
 # include	<err.h>
@@ -149,7 +149,7 @@
 		}
 
 		chkshot(bp, next);
-		free((char *) bp);
+		free(bp);
 	}
 
 	for (pp = Player; pp < End_player; pp++)
@@ -315,7 +315,7 @@
 					pp->p_ident->i_saved++;
 				message(pp, "Absorbed charge (good shield!)");
 				pp->p_ident->i_absorbed += bp->b_charge;
-				free((char *) bp);
+				free(bp);
 				(void) snprintf(Buf, sizeof(Buf),
 						"%3d", pp->p_ammo);
 				cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
@@ -497,7 +497,7 @@
 			pp = play_at(bp->b_y, bp->b_x);
 			pp->p_ammo += bp->b_charge;
 			message(pp, "**** Absorbed drone ****");
-			free((char *) bp);
+			free(bp);
 			(void) snprintf(Buf, sizeof(buf), "%3d", pp->p_ammo);
 			cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
 			outstr(pp, Buf, 3);
@@ -785,7 +785,7 @@
 		}
 		break;
 	}
-	nbp = (BULLET *) malloc(sizeof (BULLET));
+	nbp = malloc(sizeof(*nbp));
 	*nbp = *bp;
 # ifdef VOLCANO
 	move_slime(nbp, nbp->b_type == SLIME ? SLIMESPEED : LAVASPEED, next);
@@ -811,7 +811,7 @@
 
 	if (speed == 0) {
 		if (bp->b_charge <= 0)
-			free((char *) bp);
+			free(bp);
 		else
 			save_bullet(bp);
 		return;
@@ -847,7 +847,7 @@
 	}
 
 	if (--bp->b_charge <= 0) {
-		free((char *) bp);
+		free(bp);
 		return;
 	}
 
@@ -952,7 +952,7 @@
 		move_slime(nbp, speed - 1, next);
 	}
 
-	free((char *) bp);
+	free(bp);
 }
 
 /*

Reply via email to