mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
remove malloc/calloc/realloc* casts, due to stdlib.h being present; ok millert krw
This commit is contained in:
parent
fff13c0cb7
commit
ca161728cb
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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]++;
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user