From b4927eeb3c0ce78e92584e8f5c602101445e1cc4 Mon Sep 17 00:00:00 2001 From: dholland Date: Sat, 4 Jul 2009 01:01:18 +0000 Subject: Remove a pile of bogus casts. One object file diff, crosschecked and found harmless. --- hunt/huntd/answer.c | 18 +++++++++--------- hunt/huntd/ctl_transact.c | 8 ++++---- hunt/huntd/driver.c | 14 +++++++------- hunt/huntd/execute.c | 6 +++--- hunt/huntd/expl.c | 8 ++++---- hunt/huntd/faketalk.c | 8 ++++---- hunt/huntd/get_names.c | 6 +++--- hunt/huntd/shots.c | 18 +++++++++--------- 8 files changed, 43 insertions(+), 43 deletions(-) (limited to 'hunt') diff --git a/hunt/huntd/answer.c b/hunt/huntd/answer.c index d44bd034..c7c45767 100644 --- a/hunt/huntd/answer.c +++ b/hunt/huntd/answer.c @@ -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 #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 @@ -90,15 +90,15 @@ answer() 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 @@ answer() 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 @@ answer() 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 @@ get_ident(machine, uid, name, team) 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; diff --git a/hunt/huntd/ctl_transact.c b/hunt/huntd/ctl_transact.c index 1dd3f29b..3e905923 100644 --- a/hunt/huntd/ctl_transact.c +++ b/hunt/huntd/ctl_transact.c @@ -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 @@ ctl_transact(target, msg, type, rp) 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 @@ ctl_transact(target, msg, type, rp) * 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; diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index fa8e8930..5fcc9b20 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -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 #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 @@ -145,20 +145,20 @@ again: 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 @@ again: 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 @@ clear_scores() for (ip = Scores; ip != NULL; ip = nextip) { nextip = ip->i_next; - (void) free((char *) ip); + (void) free(ip); } Scores = NULL; } diff --git a/hunt/huntd/execute.c b/hunt/huntd/execute.c index 46eafa91..dd887670 100644 --- a/hunt/huntd/execute.c +++ b/hunt/huntd/execute.c @@ -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 #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 @@ -496,7 +496,7 @@ create_shot(type, y, x, face, charge, size, owner, score, expl, over) { BULLET *bp; - bp = (BULLET *) malloc(sizeof (BULLET)); /* NOSTRICT */ + bp = malloc(sizeof(*bp)); if (bp == NULL) { if (owner != NULL) message(owner, "Out of memory"); diff --git a/hunt/huntd/expl.c b/hunt/huntd/expl.c index 82c91cb3..ff2c7463 100644 --- a/hunt/huntd/expl.c +++ b/hunt/huntd/expl.c @@ -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 #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 @@ -57,7 +57,7 @@ showexpl(y, x, type) 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 @@ rollexpl() 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]; diff --git a/hunt/huntd/faketalk.c b/hunt/huntd/faketalk.c index 15291784..54e125bb 100644 --- a/hunt/huntd/faketalk.c +++ b/hunt/huntd/faketalk.c @@ -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 #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 @@ faketalk() * 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 @@ do_announce(s) 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"); diff --git a/hunt/huntd/get_names.c b/hunt/huntd/get_names.c index bfb32767..7acda59e 100644 --- a/hunt/huntd/get_names.c +++ b/hunt/huntd/get_names.c @@ -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 #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 @@ get_remote_name(his_address) 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)); diff --git a/hunt/huntd/shots.c b/hunt/huntd/shots.c index 37b3c29d..ecc08a48 100644 --- a/hunt/huntd/shots.c +++ b/hunt/huntd/shots.c @@ -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 #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 @@ -149,7 +149,7 @@ moveshots() } chkshot(bp, next); - free((char *) bp); + free(bp); } for (pp = Player; pp < End_player; pp++) @@ -315,7 +315,7 @@ move_normal_shot(bp) 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 @@ drone_move: 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 @@ chkslime(bp, next) } 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 @@ move_slime(bp, speed, next) if (speed == 0) { if (bp->b_charge <= 0) - free((char *) bp); + free(bp); else save_bullet(bp); return; @@ -847,7 +847,7 @@ move_slime(bp, speed, next) } if (--bp->b_charge <= 0) { - free((char *) bp); + free(bp); return; } @@ -952,7 +952,7 @@ move_slime(bp, speed, next) move_slime(nbp, speed - 1, next); } - free((char *) bp); + free(bp); } /* -- cgit v1.2.3-56-ge451