summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--games/adventure/io.c4
-rw-r--r--games/arithmetic/arithmetic.c4
-rw-r--r--games/atc/list.c4
-rw-r--r--games/backgammon/backgammon/move.c4
-rw-r--r--games/battlestar/save.c8
-rw-r--r--games/gomoku/pickmove.c9
-rw-r--r--games/hunt/huntd/answer.c4
-rw-r--r--games/hunt/huntd/execute.c4
-rw-r--r--games/hunt/huntd/expl.c4
-rw-r--r--games/hunt/huntd/shots.c4
-rw-r--r--games/monop/cards.c4
-rw-r--r--games/monop/execute.c4
-rw-r--r--games/monop/initdeck.c6
-rw-r--r--games/monop/monop.c4
-rw-r--r--games/monop/prop.c4
-rw-r--r--games/sail/dr_main.c4
-rw-r--r--games/sail/pl_main.c4
-rw-r--r--games/worm/worm.c4
18 files changed, 41 insertions, 42 deletions
diff --git a/games/adventure/io.c b/games/adventure/io.c
index 4c02ccb096e..deff7e487e7 100644
--- a/games/adventure/io.c
+++ b/games/adventure/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.19 2014/12/08 21:56:27 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.20 2015/08/22 14:47:40 deraadt Exp $ */
/* $NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $ */
/*-
@@ -572,7 +572,7 @@ pspeak(int m, int skip)
char *tbuf;
msg = &ptext[m];
- if ((tbuf = (char *) malloc(msg->txtlen + 1)) == 0)
+ if ((tbuf = malloc(msg->txtlen + 1)) == 0)
err(1, NULL);
memcpy(tbuf, msg->seekadr, msg->txtlen + 1); /* Room to null */
s = tbuf;
diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c
index 0c14c265d25..c7796e0986a 100644
--- a/games/arithmetic/arithmetic.c
+++ b/games/arithmetic/arithmetic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arithmetic.c,v 1.18 2013/08/29 20:22:09 naddy Exp $ */
+/* $OpenBSD: arithmetic.c,v 1.19 2015/08/22 14:47:41 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -284,7 +284,7 @@ penalise(int value, int op, int operand)
struct penalty *p;
op = opnum(op);
- if ((p = (struct penalty *)malloc((u_int)sizeof(*p))) == NULL)
+ if ((p = malloc(sizeof(*p))) == NULL)
return;
p->next = penlist[op][operand];
penlist[op][operand] = p;
diff --git a/games/atc/list.c b/games/atc/list.c
index 0da162435e0..310124ec6f0 100644
--- a/games/atc/list.c
+++ b/games/atc/list.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: list.c,v 1.7 2009/10/27 23:59:23 deraadt Exp $ */
+/* $OpenBSD: list.c,v 1.8 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: list.c,v 1.3 1995/03/21 15:04:18 cgd Exp $ */
/*-
@@ -49,7 +49,7 @@ newplane(void)
{
PLANE *p;
- if ((p = (PLANE *) calloc(1, sizeof (PLANE))) == NULL)
+ if ((p = calloc(1, sizeof (PLANE))) == NULL)
loser(NULL, "Out of memory");
return (p);
}
diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c
index 9efa4984a70..bdccc61f450 100644
--- a/games/backgammon/backgammon/move.c
+++ b/games/backgammon/backgammon/move.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: move.c,v 1.11 2015/06/26 19:18:03 otto Exp $ */
+/* $OpenBSD: move.c,v 1.12 2015/08/22 14:47:41 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -306,7 +306,7 @@ nextfree()
struct BOARD *new;
if (freeq == 0) {
- new = (struct BOARD *)calloc (1, sizeof(struct BOARD));
+ new = calloc (1, sizeof(struct BOARD));
if (new == 0) {
addstr("\nOut of memory\n");
getout(0);
diff --git a/games/battlestar/save.c b/games/battlestar/save.c
index ea3266f221f..e347b9e58fc 100644
--- a/games/battlestar/save.c
+++ b/games/battlestar/save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: save.c,v 1.11 2009/10/27 23:59:24 deraadt Exp $ */
+/* $OpenBSD: save.c,v 1.12 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: save.c,v 1.3 1995/03/21 15:07:57 cgd Exp $ */
/*
@@ -153,7 +153,7 @@ save_file_name(const char *filename, size_t len)
size_t tmpl;
if (memchr(filename, '/', len)) {
- if ((newname = (char *)malloc(len + 1)) == NULL) {
+ if ((newname = malloc(len + 1)) == NULL) {
warnx("out of memory");
return NULL;
}
@@ -162,7 +162,7 @@ save_file_name(const char *filename, size_t len)
} else {
if ((home = getenv("HOME")) != NULL) {
tmpl = strlen(home);
- if ((newname = (char *)malloc(tmpl + len + 2)) == NULL) {
+ if ((newname = malloc(tmpl + len + 2)) == NULL) {
warnx("out of memory");
return NULL;
}
@@ -171,7 +171,7 @@ save_file_name(const char *filename, size_t len)
memcpy(newname + tmpl + 1, filename, len);
newname[tmpl + len + 1] = 0;
} else {
- if ((newname = (char *)malloc(len + 1)) == NULL) {
+ if ((newname = malloc(len + 1)) == NULL) {
warnx("out of memory");
return NULL;
}
diff --git a/games/gomoku/pickmove.c b/games/gomoku/pickmove.c
index d7d67b3fcc0..098cce378e6 100644
--- a/games/gomoku/pickmove.c
+++ b/games/gomoku/pickmove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pickmove.c,v 1.13 2014/12/05 00:48:57 deraadt Exp $ */
+/* $OpenBSD: pickmove.c,v 1.14 2015/08/22 14:47:41 deraadt Exp $ */
/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
@@ -464,8 +464,7 @@ makecombo2(ocbp, osp, off, s)
n = baseB;
/* make a new combo! */
- ncbp = (struct combostr *)malloc(sizeof(struct combostr) +
- 2 * sizeof(struct combostr *));
+ ncbp = reallocarray(NULL, 3, sizeof(struct combostr));
if (ncbp == (struct combostr *)NULL)
qlog("Memory allocation failure.");
scbpp = (struct combostr **)(ncbp + 1);
@@ -707,7 +706,7 @@ makecombo(ocbp, osp, off, s)
n = baseB;
/* make a new combo! */
- ncbp = (struct combostr *)malloc(sizeof(struct combostr) +
+ ncbp = malloc(sizeof(struct combostr) +
(cbp->c_nframes + 1) * sizeof(struct combostr *));
if (ncbp == (struct combostr *)NULL)
qlog("Memory allocation failure.");
@@ -910,7 +909,7 @@ makeempty(ocbp)
continue;
/* add the combo to the list of empty spots */
- nep = (struct elist *)malloc(sizeof(struct elist));
+ nep = malloc(sizeof(struct elist));
if (nep == (struct elist *)NULL)
qlog("Memory allocation failure.");
nep->e_combo = ocbp;
diff --git a/games/hunt/huntd/answer.c b/games/hunt/huntd/answer.c
index c8ae243c655..19b519934a6 100644
--- a/games/hunt/huntd/answer.c
+++ b/games/hunt/huntd/answer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: answer.c,v 1.13 2014/05/25 17:39:07 tedu Exp $ */
+/* $OpenBSD: answer.c,v 1.14 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -485,7 +485,7 @@ get_ident(sa, salen, uid, name, team)
}
else {
/* Alloc new entry -- it is released in clear_scores() */
- ip = (IDENT *) malloc(sizeof (IDENT));
+ ip = malloc(sizeof (IDENT));
if (ip == NULL) {
logit(LOG_ERR, "malloc");
/* Fourth down, time to punt */
diff --git a/games/hunt/huntd/execute.c b/games/hunt/huntd/execute.c
index c5ad00eba31..4706988f19b 100644
--- a/games/hunt/huntd/execute.c
+++ b/games/hunt/huntd/execute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: execute.c,v 1.8 2004/01/16 00:13:19 espie Exp $ */
+/* $OpenBSD: execute.c,v 1.9 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: execute.c,v 1.2 1997/10/10 16:33:13 lukem Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -516,7 +516,7 @@ create_shot(type, y, x, face, charge, size, owner, score, expl, over)
{
BULLET *bp;
- bp = (BULLET *) malloc(sizeof (BULLET)); /* NOSTRICT */
+ bp = malloc(sizeof (BULLET)); /* NOSTRICT */
if (bp == NULL) {
logit(LOG_ERR, "malloc");
if (owner != NULL)
diff --git a/games/hunt/huntd/expl.c b/games/hunt/huntd/expl.c
index 5046c392c52..4bf8ba3fd47 100644
--- a/games/hunt/huntd/expl.c
+++ b/games/hunt/huntd/expl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expl.c,v 1.9 2007/09/04 22:39:31 hshoexer Exp $ */
+/* $OpenBSD: expl.c,v 1.10 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: expl.c,v 1.2 1997/10/10 16:33:18 lukem Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -58,7 +58,7 @@ showexpl(y, x, type)
return;
if (x < 0 || x >= WIDTH)
return;
- ep = (EXPL *) malloc(sizeof (EXPL)); /* NOSTRICT */
+ ep = malloc(sizeof (EXPL)); /* NOSTRICT */
if (ep == NULL) {
logit(LOG_ERR, "malloc");
return;
diff --git a/games/hunt/huntd/shots.c b/games/hunt/huntd/shots.c
index 00c79c34dad..30db0f1bc09 100644
--- a/games/hunt/huntd/shots.c
+++ b/games/hunt/huntd/shots.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: shots.c,v 1.9 2006/03/27 00:10:15 tedu Exp $ */
+/* $OpenBSD: shots.c,v 1.10 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: shots.c,v 1.3 1997/10/11 08:13:50 lukem Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -875,7 +875,7 @@ chkslime(bp, next)
}
/* Duplicate the unit of slime: */
- nbp = (BULLET *) malloc(sizeof (BULLET));
+ nbp = malloc(sizeof (BULLET));
if (nbp == NULL) {
logit(LOG_ERR, "malloc");
return;
diff --git a/games/monop/cards.c b/games/monop/cards.c
index 4ceb220f9cf..8c37ff054f2 100644
--- a/games/monop/cards.c
+++ b/games/monop/cards.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cards.c,v 1.9 2009/10/27 23:59:26 deraadt Exp $ */
+/* $OpenBSD: cards.c,v 1.10 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: cards.c,v 1.3 1995/03/23 08:34:35 cgd Exp $ */
/*
@@ -88,7 +88,7 @@ set_up(dp)
int r1, r2;
int i;
- if ((dp->offsets = (int32_t *) calloc(dp->num_cards, sizeof (int32_t))) == NULL)
+ if ((dp->offsets = calloc(dp->num_cards, sizeof (int32_t))) == NULL)
err(1, NULL);
for (i = 0 ; i < dp->num_cards ; i++) {
if (fread(&dp->offsets[i], sizeof(dp->offsets[i]), 1, deckf) != 1)
diff --git a/games/monop/execute.c b/games/monop/execute.c
index de6d7436db0..59c5b9226c4 100644
--- a/games/monop/execute.c
+++ b/games/monop/execute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: execute.c,v 1.10 2014/12/08 21:11:02 tedu Exp $ */
+/* $OpenBSD: execute.c,v 1.11 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: execute.c,v 1.3 1995/03/23 08:34:38 cgd Exp $ */
/*
@@ -324,7 +324,7 @@ badness:
player < 0 || player >= num_play ||
num_doub < 0 || num_doub > 2)
goto badness;
- if ((play = (PLAY *)calloc(num_play, sizeof(PLAY))) == NULL)
+ if ((play = calloc(num_play, sizeof(PLAY))) == NULL)
err(1, NULL);
cur_p = play + player;
/* Names */
diff --git a/games/monop/initdeck.c b/games/monop/initdeck.c
index 7b51519108c..210adfa7c7f 100644
--- a/games/monop/initdeck.c
+++ b/games/monop/initdeck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: initdeck.c,v 1.13 2009/10/27 23:59:26 deraadt Exp $ */
+/* $OpenBSD: initdeck.c,v 1.14 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $ */
/*
@@ -77,9 +77,9 @@ main(ac, av)
/*
* allocate space for pointers.
*/
- if ((CC_D.offsets = (int32_t *)calloc(CC_D.num_cards + 1,
+ if ((CC_D.offsets = calloc(CC_D.num_cards + 1,
sizeof (int32_t))) == NULL ||
- (CH_D.offsets = (int32_t *)calloc(CH_D.num_cards + 1,
+ (CH_D.offsets = calloc(CH_D.num_cards + 1,
sizeof (int32_t))) == NULL)
err(1, NULL);
fseek(inf, 0L, SEEK_SET);
diff --git a/games/monop/monop.c b/games/monop/monop.c
index 123923f0208..c8136f9dbee 100644
--- a/games/monop/monop.c
+++ b/games/monop/monop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monop.c,v 1.12 2014/12/08 21:11:02 tedu Exp $ */
+/* $OpenBSD: monop.c,v 1.13 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $ */
/*
@@ -85,7 +85,7 @@ blew_it:
else
break;
}
- if ((cur_p = play = (PLAY *) calloc(num_play, sizeof (PLAY))) == NULL)
+ if ((cur_p = play = calloc(num_play, sizeof (PLAY))) == NULL)
err(1, NULL);
for (i = 0; i < num_play; i++) {
do {
diff --git a/games/monop/prop.c b/games/monop/prop.c
index be3044b8bda..8ef55250af0 100644
--- a/games/monop/prop.c
+++ b/games/monop/prop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: prop.c,v 1.8 2014/12/08 21:11:02 tedu Exp $ */
+/* $OpenBSD: prop.c,v 1.9 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: prop.c,v 1.3 1995/03/23 08:35:06 cgd Exp $ */
/*
@@ -61,7 +61,7 @@ add_list(plr, head, op_sqr)
OWN *tp, *last_tp;
OWN *op;
- if ((op = (OWN *)calloc(1, sizeof (OWN))) == NULL)
+ if ((op = calloc(1, sizeof (OWN))) == NULL)
err(1, NULL);
op->sqr = &board[op_sqr];
val = value(op->sqr);
diff --git a/games/sail/dr_main.c b/games/sail/dr_main.c
index 886b94e2ac2..fd016d75174 100644
--- a/games/sail/dr_main.c
+++ b/games/sail/dr_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dr_main.c,v 1.5 2009/10/27 23:59:27 deraadt Exp $ */
+/* $OpenBSD: dr_main.c,v 1.6 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: dr_main.c,v 1.4 1995/04/22 10:36:52 cgd Exp $ */
/*
@@ -56,7 +56,7 @@ dr_main()
nat[n] = 0;
foreachship(sp) {
if (sp->file == NULL &&
- (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL) {
+ (sp->file = calloc(1, sizeof (struct File))) == NULL) {
(void) fprintf(stderr, "DRIVER: Out of memory.\n");
exit(1);
}
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 56b221ca2dc..c276ff4b5ad 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl_main.c,v 1.13 2014/03/11 07:42:55 guenther Exp $ */
+/* $OpenBSD: pl_main.c,v 1.14 2015/08/22 14:47:41 deraadt Exp $ */
/* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */
/*
@@ -83,7 +83,7 @@ reprint:
nat[n] = 0;
foreachship(sp) {
if (sp->file == NULL &&
- (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL)
+ (sp->file = calloc(1, sizeof (struct File))) == NULL)
err(1, NULL);
sp->file->index = sp - SHIP(0);
sp->file->stern = nat[sp->nationality]++;
diff --git a/games/worm/worm.c b/games/worm/worm.c
index fa9f22fd807..15861f3e42c 100644
--- a/games/worm/worm.c
+++ b/games/worm/worm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worm.c,v 1.29 2015/08/21 02:42:26 deraadt Exp $ */
+/* $OpenBSD: worm.c,v 1.30 2015/08/22 14:47:41 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -359,7 +359,7 @@ newlink(void)
{
struct body *tmp;
- if ((tmp = (struct body *) malloc(sizeof (struct body))) == NULL) {
+ if ((tmp = malloc(sizeof (struct body))) == NULL) {
endwin();
errx(1, "out of memory");
}